beautypg.com

Senddraftmessage(id, callbackfunction) – Grandstream GXP2200 GMI Web Service Guide User Manual

Page 25

background image

GXP2200 GMI WEB SERVICE GUIDE V1.0

Page 24 of 38

24. setNewMessage(num, account, text, flag, callbackFunction)

Description

Send message; save message

Parameters

• num: The number to send the message to
• account: Account index
• text: Message content
• flag: Save or send message. 0 - save message to Draft box; 1 - send message
• callbackFunction: Call back function

HTTP Request

• url: "http://"+ ip + "/manager?"
• action: "setnewmessage"
• number: "8107314"
• account: "0"
• content: "hello"
• flag: "1"
• format: "json"
• jsoncallback: "?" (This is the HTTP request for the call back function, usually used in

AJAX and JQuery)

• For example:

http://192.168.121.230/manager?action=setnewmessage&number=8107314&accou

nt=0&content=hello&flag=1&format=json&jsoncallback=?

Return

1. HTTP request return:

• Successful

"{"res": "success"}"

• Failed

"{"res" : "error", "msg" : "set new message failed"}"

• Parameters in wrong format (GMI version 9 or newer)

"{"res" : "error", "msg" : "wrong format"}"

• Database operation error (GMI version 9 or newer)

"{"res" : "error", "msg" : "0"}"

25. sendDraftMessage(id, callbackFunction)

Description

Send message from Draft box. After the message is sent, it will be moved from Draft

box to Outbox

Parameters

• id: Message ID
• callbackFunction: Call back function