[asterisk-users] How to send a SIP MESSAGE outside a call
Tiago Vasconcelos
tiago.o.vasconcelos at gmail.com
Sun Jul 29 16:19:00 CDT 2012
On 28-07-2012 18:23, Matthew Jordan wrote:
> You stated that you need to add some custom headers, which you can do with the
> MESSAGE_DATA function. In order to activate the forwarding, you could
> do something like this:
>
> exten => send_msg,1,NoOp()
> same => n,Set(MESSAGE_DATA(X-Movial-Content)=application/x-movial-control;forwarding=true)
> ; If something needs to go in the body, replace this. Otherwise,
> ; you can just remove it
> same => n,Set(MESSAGE(body)=hello world!)
> same => n,MessageSend(sip:to_address)
Matthew, you used the name "send_msg" which I found confusing since
extensions.conf is the dialplan configuration file. So an "exten =>" is
triggered by either an outbound or an inbound call.
I admit I may be ignorant, so could you please clarify how the message
sending code you wrote above fits in the dialplan? How can it be
triggered other than by an inbound/outbound call?
Since I didn't figure another way to do it, I associated your code with
an extension. The idea was when the 101 extension is dialled, the SIP
MESSAGE is sent to the provider:
exten => 101,1,NoOp()
same =>
n,Set(MESSAGE_DATA(X-Movial-Content)=application/x-movial-control;forwarding=true)
same => n,MessageSend(sip:54395135465 at provider)
But when I test it I get two errors:
-- Executing [101 at house:1] NoOp("SIP/me1-0000000e", "") in new stack
-- Executing [101 at house:2] Set("SIP/me1-0000000e",
"MESSAGE_DATA(X-Movial-Content") in new stack
[Jul 29 21:09:25] WARNING[32728]: pbx.c:10208 pbx_builtin_setvar: Set
requires an '=' to be a valid assignment.
-- Executing [101 at house:3] MessageSend("SIP/me1-0000000e",
"sip:54395135465 at provider") in new stack
[Jul 29 21:09:25] WARNING[32728]: message.c:992 msg_send_exec: No
message data found on channel to send.
First, apparently Asterisk doesn't not like the syntax used for
MESSAGE_DATA, although it seems correct... Could it be because the value
also has a "=" sign?
Second, it complains "No message data found on channel to send". Maybe
if the MESSAGE_DATA function was successful, this error would not show
up. Or maybe I need to set an empty message body.
This feature of Asterisk is so new that there are almost no
configuration examples of this on the Internet. So your help is really
precious.
Tested with Asterisk 10.7.0-rc1
Thanks,
- Tiago
More information about the asterisk-users
mailing list