VoIP Mailing List Archives
Mailing list archives for the VoIP community |
|
View previous topic :: View next topic |
Author |
Message |
emo at svep.se Guest
|
Posted: Mon Sep 21, 2015 1:49 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
Hi,
I'm having trouble configuring Asterisk to respond to an incoming out of call SIP MESSAGE. The transport protocol is TLS and the Asterisk version is 10 (it's old, but I'm kind of stuck with it at the moment). Currently I have roughly the following configuration and handling:
sip.conf:
[general]
accet_outofcall_messages=yes
outofcall_message_context=sip-im
and extensions.conf
[sip-im]
exten _X!, 1, NoOp(Got message)
exten _X!, n, Answer()
exten _X!, n, Agi(agi://localhost/messagehandler.agi?...)
exten _X!, n, SendText(Message received)
I can see in the log from Asterisk that the script in the sip-im context is running, but there is no message sent. I have followed the code in the call, and it seems like there is no channel registered with the SendText application. Is there some other approach that I could use to send a SIP MESSAGE back to the client? Does the client need to register for this to work?
BR,
Emil
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
lmoore at omninet.net.au Guest
|
Posted: Mon Sep 21, 2015 2:37 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
Could it be in the [general] section you should have;
accept_outofcall_message=yes
Your line appears to be missing the 'p' in accept and an extraneous 's'
in message.
Larry.
On 21/09/2015 2:48 PM, Emil Ohlsson wrote:
Quote: | Hi,
I'm having trouble configuring Asterisk to respond to an incoming out of call SIP MESSAGE. The transport protocol is TLS and the Asterisk version is 10 (it's old, but I'm kind of stuck with it at the moment). Currently I have roughly the following configuration and handling:
sip.conf:
[general]
accet_outofcall_messages=yes
outofcall_message_context=sip-im
and extensions.conf
[sip-im]
exten _X!, 1, NoOp(Got message)
exten _X!, n, Answer()
exten _X!, n, Agi(agi://localhost/messagehandler.agi?...)
exten _X!, n, SendText(Message received)
I can see in the log from Asterisk that the script in the sip-im context is running, but there is no message sent. I have followed the code in the call, and it seems like there is no channel registered with the SendText application. Is there some other approach that I could use to send a SIP MESSAGE back to the client? Does the client need to register for this to work?
BR,
Emil
|
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
darcy at Vex.Net Guest
|
Posted: Mon Sep 21, 2015 9:45 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
On Mon, 21 Sep 2015 06:48:52 +0000
Emil Ohlsson <emo@svep.se> wrote:
Quote: | [sip-im]
exten _X!, 1, NoOp(Got message)
exten _X!, n, Answer()
exten _X!, n, Agi(agi://localhost/messagehandler.agi?...)
exten _X!, n, SendText(Message received)
|
I am not an expert but perhaps you want this.
[sip-im]
exten s,1,NoOp(Got message)
same,n,Answer()
same,n,Agi(agi://localhost/messagehandler.agi?...)
same,n,SendText(Message received)
Replacing "exten _X!" with "same" is just a shortcut. I find that
there are lots of places where spaces cause problems so I just remove
them all for good measure. Finally, I am not sure what the mechanism
is here but if it is like a goto then I think that you want the 's'
priority.
Or, I totally don't know what I am talking about and my education will
be advanced by the replies to this message.
--
D'Arcy J.M. Cain
System Administrator, Vex.Net
http://www.Vex.Net/ IM:darcy@Vex.Net
VoIP: sip:darcy@Vex.Net
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mjordan at digium.com Guest
|
Posted: Mon Sep 21, 2015 10:02 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
On Mon, Sep 21, 2015 at 9:45 AM, D'Arcy J.M. Cain <darcy@vex.net> wrote:
Quote: | On Mon, 21 Sep 2015 06:48:52 +0000
Emil Ohlsson <emo@svep.se> wrote:
Quote: | [sip-im]
exten _X!, 1, NoOp(Got message)
exten _X!, n, Answer()
exten _X!, n, Agi(agi://localhost/messagehandler.agi?...)
exten _X!, n, SendText(Message received)
|
I am not an expert but perhaps you want this.
[sip-im]
exten s,1,NoOp(Got message)
same,n,Answer()
same,n,Agi(agi://localhost/messagehandler.agi?...)
same,n,SendText(Message received)
Replacing "exten _X!" with "same" is just a shortcut. I find that
there are lots of places where spaces cause problems so I just remove
them all for good measure. Finally, I am not sure what the mechanism
is here but if it is like a goto then I think that you want the 's'
priority.
Or, I totally don't know what I am talking about and my education will
be advanced by the replies to this message.
|
If you want to send an out of call SIP MESSAGE request, you'll need to
use the MessageSend application:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+10+Application_MessageSend
SendText is used for sending text messages within a call. Since a SIP
channel is not servicing the out of call text message, you cannot use
it to send a SIP MESSAGE request back to whatever sent the original
SIP MESSAGE request.
--
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
emo at svep.se Guest
|
Posted: Tue Sep 22, 2015 1:53 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
Yes, that is how the problem was solved before when the transport protocol for messages was UDP, but TLS (TCP) this doesn't work. Partly because MessageSend doesn't support SIPS and partly because it focuses on sending a new message instead of reusing an existing stream. Using wireshark I can see that the TLS stream is still alive as there is no tear down communication.
The "same,n," is a good shortcut to make the text more readable, I'll add that but I don't think that is the cause as I can follow the source code and see that the SendText command is executed but fails silently.
Thanks for the feedback,
Emil
________________________________________
From: Matthew Jordan <mjordan@digium.com>
Sent: Monday, September 21, 2015 5:01 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Cc: Emil Ohlsson
Subject: Re: [asterisk-users] Respond to an out of call SIP MESSAGE
On Mon, Sep 21, 2015 at 9:45 AM, D'Arcy J.M. Cain <darcy@vex.net> wrote:
Quote: | On Mon, 21 Sep 2015 06:48:52 +0000
Emil Ohlsson <emo@svep.se> wrote:
Quote: | [sip-im]
exten _X!, 1, NoOp(Got message)
exten _X!, n, Answer()
exten _X!, n, Agi(agi://localhost/messagehandler.agi?...)
exten _X!, n, SendText(Message received)
|
I am not an expert but perhaps you want this.
[sip-im]
exten s,1,NoOp(Got message)
same,n,Answer()
same,n,Agi(agi://localhost/messagehandler.agi?...)
same,n,SendText(Message received)
Replacing "exten _X!" with "same" is just a shortcut. I find that
there are lots of places where spaces cause problems so I just remove
them all for good measure. Finally, I am not sure what the mechanism
is here but if it is like a goto then I think that you want the 's'
priority.
Or, I totally don't know what I am talking about and my education will
be advanced by the replies to this message.
|
If you want to send an out of call SIP MESSAGE request, you'll need to
use the MessageSend application:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+10+Application_MessageSend
SendText is used for sending text messages within a call. Since a SIP
channel is not servicing the out of call text message, you cannot use
it to send a SIP MESSAGE request back to whatever sent the original
SIP MESSAGE request.
--
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
jcolp at digium.com Guest
|
Posted: Tue Sep 22, 2015 5:45 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
On 15-09-22 03:53 AM, Emil Ohlsson wrote:
Quote: | Yes, that is how the problem was solved before when the transport
protocol for messages was UDP, but TLS (TCP) this doesn't work.
Partly because MessageSend doesn't support SIPS and partly because it
focuses on sending a new message instead of reusing an existing
stream. Using wireshark I can see that the TLS stream is still alive
as there is no tear down communication.
|
What is the complete console output as well as endpoint configuration?
It should work fine, provided stuff is configured and used right.
--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
emo at svep.se Guest
|
Posted: Mon Sep 28, 2015 7:16 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
Sorry for the delay here. For some reason the mail from Joshua Colp failed to deliver to my mailbox.
So, anyway, I've set up a local scenario on my computer a PJSIP client and Asterisk 11.17.1 (On a fedora linux workstation) with the settings listed below. In this scenario I've used UDP, but I want a configuration that can be used with any transport protocol.
I can see that the context runs correctly, but there is no message delivered to the client. Am I approaching this the wrong way?
sip.conf:
[general]
context=public ; Default context for incoming calls. Defaults to 'default'
allowoverlap=no ; Disable overlap dialing support. (Default is yes)
realm=my_realm ; Realm for digest authentication
udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
tcpenable=no ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
transport=udp ; Set the default transports. The order determines the primary default transport.
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
accept_outofcall_message = yes ; Disable this option to reject all MESSAGE requests outside of a
outofcall_message_context = tutorial ; Context all out of dialog msgs are sent to. When this
[authentication]
[alice]
type=friend
host=dynamic
username=alice
secret=TopSecret
nat=no
transport=udp
context=tutorial
extensions.conf:
[general]
static=yes
writeprotect=no
clearglobalvars=no
[tutorial]
exten => _X!,1,NoOp(Got message)
exten => _X!,n,Answer()
exten => _X!,n,SendText(Zup dawg)
exten => _X!,n,NoOp(Done with message)
And when I run the scenario I get the following log:
<--- SIP read from UDP:127.0.0.1:5059 --->
REGISTER sip:127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5059;rport;branch=z9hG4bKPjd629f029-a971-4c83-9920-bb02da26cc25
Max-Forwards: 70
From: <sip:alice@127.0.0.1>;tag=4b251b50-2a30-498c-a7bd-9502271e8ac2
To: <sip:alice@127.0.0.1>
Call-ID: be616b5b-a301-477e-a4bc-c011bcecd4f0
CSeq: 17321 REGISTER
Contact: <sip:alice@127.0.0.1:5059;ob>
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0
<------------->
--- (11 headers 0 lines) ---
Sending to 127.0.0.1:5059 (no NAT)
Sending to 127.0.0.1:5059 (no NAT)
<--- Transmitting (no NAT) to 127.0.0.1:5059 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 127.0.0.1:5059;branch=z9hG4bKPjd629f029-a971-4c83-9920-bb02da26cc25;received=127.0.0.1;rport=5059
From: <sip:alice@127.0.0.1>;tag=4b251b50-2a30-498c-a7bd-9502271e8ac2
To: <sip:alice@127.0.0.1>;tag=as62d4da5c
Call-ID: be616b5b-a301-477e-a4bc-c011bcecd4f0
CSeq: 17321 REGISTER
Server: Asterisk PBX 11.17.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="my_realm", nonce="394fd8d9"
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog 'be616b5b-a301-477e-a4bc-c011bcecd4f0' in 32000 ms (Method: REGISTER)
<--- SIP read from UDP:127.0.0.1:5059 --->
REGISTER sip:127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5059;rport;branch=z9hG4bKPj8905923d-2405-45dc-97c9-8abb213075c7
Max-Forwards: 70
From: <sip:alice@127.0.0.1>;tag=4b251b50-2a30-498c-a7bd-9502271e8ac2
To: <sip:alice@127.0.0.1>
Call-ID: be616b5b-a301-477e-a4bc-c011bcecd4f0
CSeq: 17322 REGISTER
Contact: <sip:alice@127.0.0.1:5059;ob>
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username="alice", realm="my_realm", nonce="394fd8d9", uri="sip:127.0.0.1:5060", response="e72c84753c7768e0048c094d37ac6c70", algorithm=MD5
Content-Length: 0
<------------->
--- (12 headers 0 lines) ---
Sending to 127.0.0.1:5059 (no NAT)
<--- Transmitting (no NAT) to 127.0.0.1:5059 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 127.0.0.1:5059;branch=z9hG4bKPj8905923d-2405-45dc-97c9-8abb213075c7;received=127.0.0.1;rport=5059
From: <sip:alice@127.0.0.1>;tag=4b251b50-2a30-498c-a7bd-9502271e8ac2
To: <sip:alice@127.0.0.1>;tag=as62d4da5c
Call-ID: be616b5b-a301-477e-a4bc-c011bcecd4f0
CSeq: 17322 REGISTER
Server: Asterisk PBX 11.17.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 300
Contact: <sip:alice@127.0.0.1:5059;ob>;expires=300
Date: Mon, 28 Sep 2015 12:03:22 GMT
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog 'be616b5b-a301-477e-a4bc-c011bcecd4f0' in 32000 ms (Method: REGISTER)
<--- SIP read from UDP:127.0.0.1:5059 --->
MESSAGE sip:1234@127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5059;rport;branch=z9hG4bKPjb2135f5d-b7ba-43e6-a1d9-1f2729b2f1b2
Max-Forwards: 70
From: <sip:alice@127.0.0.1>;tag=c12f77aa-d0d5-4517-8430-bf4406006397
To: <sip:1234@127.0.0.1>
Call-ID: 1b6ac040-4af5-4015-a85d-fb5c48831d6f
CSeq: 1266 MESSAGE
Accept: text/plain, application/im-iscomposing+xml
Content-Type: text/plain
Content-Length: 13
Hello, world!
<------------->
--- (10 headers 1 lines) ---
Sending to 127.0.0.1:5059 (no NAT)
Receiving message!
Found peer 'alice' for 'alice' from 127.0.0.1:5059
<--- Transmitting (no NAT) to 127.0.0.1:5059 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 127.0.0.1:5059;branch=z9hG4bKPjb2135f5d-b7ba-43e6-a1d9-1f2729b2f1b2;received=127.0.0.1;rport=5059
From: <sip:alice@127.0.0.1>;tag=c12f77aa-d0d5-4517-8430-bf4406006397
To: <sip:1234@127.0.0.1>;tag=as32a0932b
Call-ID: 1b6ac040-4af5-4015-a85d-fb5c48831d6f
CSeq: 1266 MESSAGE
Server: Asterisk PBX 11.17.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="my_realm", nonce="0698f476"
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog '1b6ac040-4af5-4015-a85d-fb5c48831d6f' in 32000 ms (Method: MESSAGE)
Scheduling destruction of SIP dialog '1b6ac040-4af5-4015-a85d-fb5c48831d6f' in 32000 ms (Method: MESSAGE)
<--- SIP read from UDP:127.0.0.1:5059 --->
MESSAGE sip:1234@127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5059;rport;branch=z9hG4bKPj71f66ce8-9f0f-4841-aca8-ced79085ad65
Max-Forwards: 70
From: <sip:alice@127.0.0.1>;tag=c12f77aa-d0d5-4517-8430-bf4406006397
To: <sip:1234@127.0.0.1>
Call-ID: 1b6ac040-4af5-4015-a85d-fb5c48831d6f
CSeq: 1267 MESSAGE
Accept: text/plain, application/im-iscomposing+xml
Authorization: Digest username="alice", realm="my_realm", nonce="0698f476", uri="sip:1234@127.0.0.1:5060", response="8d4ebff55b35d0363e4cd726c8f410c7", algorithm=MD5
Content-Type: text/plain
Content-Length: 13
Hello, world!
<------------->
--- (11 headers 1 lines) ---
Receiving message!
Found peer 'alice' for 'alice' from 127.0.0.1:5059
Looking for 1234 in tutorial (domain 127.0.0.1)
<--- Transmitting (no NAT) to 127.0.0.1:5059 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 127.0.0.1:5059;branch=z9hG4bKPj71f66ce8-9f0f-4841-aca8-ced79085ad65;received=127.0.0.1;rport=5059
From: <sip:alice@127.0.0.1>;tag=c12f77aa-d0d5-4517-8430-bf4406006397
To: <sip:1234@127.0.0.1>;tag=as32a0932b
Call-ID: 1b6ac040-4af5-4015-a85d-fb5c48831d6f
CSeq: 1267 MESSAGE
Server: Asterisk PBX 11.17.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog '1b6ac040-4af5-4015-a85d-fb5c48831d6f' in 32000 ms (Method: MESSAGE)
-- Executing [1234@tutorial:1] NoOp("Message/ast_msg_queue", "Got message") in new stack
-- Executing [1234@tutorial:2] Answer("Message/ast_msg_queue", "") in new stack
-- Executing [1234@tutorial:3] SendText("Message/ast_msg_queue", "Zup dawg") in new stack
-- Executing [1234@tutorial:4] NoOp("Message/ast_msg_queue", "Done with message") in new stack
-- Auto fallthrough, channel 'Message/ast_msg_queue' status is 'UNKNOWN'
BR,
Emil
________________________________________
From: Emil Ohlsson
Sent: Tuesday, September 22, 2015 8:53 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Respond to an out of call SIP MESSAGE
Yes, that is how the problem was solved before when the transport protocol for messages was UDP, but TLS (TCP) this doesn't work. Partly because MessageSend doesn't support SIPS and partly because it focuses on sending a new message instead of reusing an existing stream. Using wireshark I can see that the TLS stream is still alive as there is no tear down communication.
The "same,n," is a good shortcut to make the text more readable, I'll add that but I don't think that is the cause as I can follow the source code and see that the SendText command is executed but fails silently.
Thanks for the feedback,
Emil
________________________________________
From: Matthew Jordan <mjordan@digium.com>
Sent: Monday, September 21, 2015 5:01 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Cc: Emil Ohlsson
Subject: Re: [asterisk-users] Respond to an out of call SIP MESSAGE
On Mon, Sep 21, 2015 at 9:45 AM, D'Arcy J.M. Cain <darcy@vex.net> wrote:
Quote: | On Mon, 21 Sep 2015 06:48:52 +0000
Emil Ohlsson <emo@svep.se> wrote:
Quote: | [sip-im]
exten _X!, 1, NoOp(Got message)
exten _X!, n, Answer()
exten _X!, n, Agi(agi://localhost/messagehandler.agi?...)
exten _X!, n, SendText(Message received)
|
I am not an expert but perhaps you want this.
[sip-im]
exten s,1,NoOp(Got message)
same,n,Answer()
same,n,Agi(agi://localhost/messagehandler.agi?...)
same,n,SendText(Message received)
Replacing "exten _X!" with "same" is just a shortcut. I find that
there are lots of places where spaces cause problems so I just remove
them all for good measure. Finally, I am not sure what the mechanism
is here but if it is like a goto then I think that you want the 's'
priority.
Or, I totally don't know what I am talking about and my education will
be advanced by the replies to this message.
|
If you want to send an out of call SIP MESSAGE request, you'll need to
use the MessageSend application:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+10+Application_MessageSend
SendText is used for sending text messages within a call. Since a SIP
channel is not servicing the out of call text message, you cannot use
it to send a SIP MESSAGE request back to whatever sent the original
SIP MESSAGE request.
--
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
jcolp at digium.com Guest
|
Posted: Mon Sep 28, 2015 7:19 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
On 15-09-28 09:16 AM, Emil Ohlsson wrote:
Quote: | Sorry for the delay here. For some reason the mail from Joshua Colp
failed to deliver to my mailbox.
So, anyway, I've set up a local scenario on my computer a PJSIP
client and Asterisk 11.17.1 (On a fedora linux workstation) with the
settings listed below. In this scenario I've used UDP, but I want a
configuration that can be used with any transport protocol.
I can see that the context runs correctly, but there is no message
delivered to the client. Am I approaching this the wrong way?
|
As Matt stated the SendText application is for sending messages
in-dialog within a call. It can't be used out of call. You have to use
the MessageSend application.
--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
emo at svep.se Guest
|
Posted: Mon Sep 28, 2015 8:20 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
(Still no not receiving the mail, revisited the settings.)
OK, so SendText doesn't work with this scenario. But can MessageSend handle this, and respond even when the transport protocol is TLS? Or do I need to modify Asterisk to add this support?
BR,
Emil
________________________________________
From: Emil Ohlsson
Sent: Monday, September 28, 2015 2:16 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Respond to an out of call SIP MESSAGE
Sorry for the delay here. For some reason the mail from Joshua Colp failed to deliver to my mailbox.
So, anyway, I've set up a local scenario on my computer a PJSIP client and Asterisk 11.17.1 (On a fedora linux workstation) with the settings listed below. In this scenario I've used UDP, but I want a configuration that can be used with any transport protocol.
I can see that the context runs correctly, but there is no message delivered to the client. Am I approaching this the wrong way?
sip.conf:
[general]
context=public ; Default context for incoming calls. Defaults to 'default'
allowoverlap=no ; Disable overlap dialing support. (Default is yes)
realm=my_realm ; Realm for digest authentication
udpbindaddr=0.0.0.0 ; IP address to bind UDP listen socket to (0.0.0.0 binds to all)
tcpenable=no ; Enable server for incoming TCP connections (default is no)
tcpbindaddr=0.0.0.0 ; IP address for TCP server to bind to (0.0.0.0 binds to all interfaces)
transport=udp ; Set the default transports. The order determines the primary default transport.
srvlookup=yes ; Enable DNS SRV lookups on outbound calls
accept_outofcall_message = yes ; Disable this option to reject all MESSAGE requests outside of a
outofcall_message_context = tutorial ; Context all out of dialog msgs are sent to. When this
[authentication]
[alice]
type=friend
host=dynamic
username=alice
secret=TopSecret
nat=no
transport=udp
context=tutorial
extensions.conf:
[general]
static=yes
writeprotect=no
clearglobalvars=no
[tutorial]
exten => _X!,1,NoOp(Got message)
exten => _X!,n,Answer()
exten => _X!,n,SendText(Zup dawg)
exten => _X!,n,NoOp(Done with message)
And when I run the scenario I get the following log:
<--- SIP read from UDP:127.0.0.1:5059 --->
REGISTER sip:127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5059;rport;branch=z9hG4bKPjd629f029-a971-4c83-9920-bb02da26cc25
Max-Forwards: 70
From: <sip:alice@127.0.0.1>;tag=4b251b50-2a30-498c-a7bd-9502271e8ac2
To: <sip:alice@127.0.0.1>
Call-ID: be616b5b-a301-477e-a4bc-c011bcecd4f0
CSeq: 17321 REGISTER
Contact: <sip:alice@127.0.0.1:5059;ob>
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Content-Length: 0
<------------->
--- (11 headers 0 lines) ---
Sending to 127.0.0.1:5059 (no NAT)
Sending to 127.0.0.1:5059 (no NAT)
<--- Transmitting (no NAT) to 127.0.0.1:5059 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 127.0.0.1:5059;branch=z9hG4bKPjd629f029-a971-4c83-9920-bb02da26cc25;received=127.0.0.1;rport=5059
From: <sip:alice@127.0.0.1>;tag=4b251b50-2a30-498c-a7bd-9502271e8ac2
To: <sip:alice@127.0.0.1>;tag=as62d4da5c
Call-ID: be616b5b-a301-477e-a4bc-c011bcecd4f0
CSeq: 17321 REGISTER
Server: Asterisk PBX 11.17.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="my_realm", nonce="394fd8d9"
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog 'be616b5b-a301-477e-a4bc-c011bcecd4f0' in 32000 ms (Method: REGISTER)
<--- SIP read from UDP:127.0.0.1:5059 --->
REGISTER sip:127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5059;rport;branch=z9hG4bKPj8905923d-2405-45dc-97c9-8abb213075c7
Max-Forwards: 70
From: <sip:alice@127.0.0.1>;tag=4b251b50-2a30-498c-a7bd-9502271e8ac2
To: <sip:alice@127.0.0.1>
Call-ID: be616b5b-a301-477e-a4bc-c011bcecd4f0
CSeq: 17322 REGISTER
Contact: <sip:alice@127.0.0.1:5059;ob>
Expires: 300
Allow: PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, INFO, SUBSCRIBE, NOTIFY, REFER, MESSAGE, OPTIONS
Authorization: Digest username="alice", realm="my_realm", nonce="394fd8d9", uri="sip:127.0.0.1:5060", response="e72c84753c7768e0048c094d37ac6c70", algorithm=MD5
Content-Length: 0
<------------->
--- (12 headers 0 lines) ---
Sending to 127.0.0.1:5059 (no NAT)
<--- Transmitting (no NAT) to 127.0.0.1:5059 --->
SIP/2.0 200 OK
Via: SIP/2.0/UDP 127.0.0.1:5059;branch=z9hG4bKPj8905923d-2405-45dc-97c9-8abb213075c7;received=127.0.0.1;rport=5059
From: <sip:alice@127.0.0.1>;tag=4b251b50-2a30-498c-a7bd-9502271e8ac2
To: <sip:alice@127.0.0.1>;tag=as62d4da5c
Call-ID: be616b5b-a301-477e-a4bc-c011bcecd4f0
CSeq: 17322 REGISTER
Server: Asterisk PBX 11.17.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Expires: 300
Contact: <sip:alice@127.0.0.1:5059;ob>;expires=300
Date: Mon, 28 Sep 2015 12:03:22 GMT
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog 'be616b5b-a301-477e-a4bc-c011bcecd4f0' in 32000 ms (Method: REGISTER)
<--- SIP read from UDP:127.0.0.1:5059 --->
MESSAGE sip:1234@127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5059;rport;branch=z9hG4bKPjb2135f5d-b7ba-43e6-a1d9-1f2729b2f1b2
Max-Forwards: 70
From: <sip:alice@127.0.0.1>;tag=c12f77aa-d0d5-4517-8430-bf4406006397
To: <sip:1234@127.0.0.1>
Call-ID: 1b6ac040-4af5-4015-a85d-fb5c48831d6f
CSeq: 1266 MESSAGE
Accept: text/plain, application/im-iscomposing+xml
Content-Type: text/plain
Content-Length: 13
Hello, world!
<------------->
--- (10 headers 1 lines) ---
Sending to 127.0.0.1:5059 (no NAT)
Receiving message!
Found peer 'alice' for 'alice' from 127.0.0.1:5059
<--- Transmitting (no NAT) to 127.0.0.1:5059 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 127.0.0.1:5059;branch=z9hG4bKPjb2135f5d-b7ba-43e6-a1d9-1f2729b2f1b2;received=127.0.0.1;rport=5059
From: <sip:alice@127.0.0.1>;tag=c12f77aa-d0d5-4517-8430-bf4406006397
To: <sip:1234@127.0.0.1>;tag=as32a0932b
Call-ID: 1b6ac040-4af5-4015-a85d-fb5c48831d6f
CSeq: 1266 MESSAGE
Server: Asterisk PBX 11.17.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
WWW-Authenticate: Digest algorithm=MD5, realm="my_realm", nonce="0698f476"
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog '1b6ac040-4af5-4015-a85d-fb5c48831d6f' in 32000 ms (Method: MESSAGE)
Scheduling destruction of SIP dialog '1b6ac040-4af5-4015-a85d-fb5c48831d6f' in 32000 ms (Method: MESSAGE)
<--- SIP read from UDP:127.0.0.1:5059 --->
MESSAGE sip:1234@127.0.0.1:5060 SIP/2.0
Via: SIP/2.0/UDP 127.0.0.1:5059;rport;branch=z9hG4bKPj71f66ce8-9f0f-4841-aca8-ced79085ad65
Max-Forwards: 70
From: <sip:alice@127.0.0.1>;tag=c12f77aa-d0d5-4517-8430-bf4406006397
To: <sip:1234@127.0.0.1>
Call-ID: 1b6ac040-4af5-4015-a85d-fb5c48831d6f
CSeq: 1267 MESSAGE
Accept: text/plain, application/im-iscomposing+xml
Authorization: Digest username="alice", realm="my_realm", nonce="0698f476", uri="sip:1234@127.0.0.1:5060", response="8d4ebff55b35d0363e4cd726c8f410c7", algorithm=MD5
Content-Type: text/plain
Content-Length: 13
Hello, world!
<------------->
--- (11 headers 1 lines) ---
Receiving message!
Found peer 'alice' for 'alice' from 127.0.0.1:5059
Looking for 1234 in tutorial (domain 127.0.0.1)
<--- Transmitting (no NAT) to 127.0.0.1:5059 --->
SIP/2.0 202 Accepted
Via: SIP/2.0/UDP 127.0.0.1:5059;branch=z9hG4bKPj71f66ce8-9f0f-4841-aca8-ced79085ad65;received=127.0.0.1;rport=5059
From: <sip:alice@127.0.0.1>;tag=c12f77aa-d0d5-4517-8430-bf4406006397
To: <sip:1234@127.0.0.1>;tag=as32a0932b
Call-ID: 1b6ac040-4af5-4015-a85d-fb5c48831d6f
CSeq: 1267 MESSAGE
Server: Asterisk PBX 11.17.1
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Length: 0
<------------>
Scheduling destruction of SIP dialog '1b6ac040-4af5-4015-a85d-fb5c48831d6f' in 32000 ms (Method: MESSAGE)
-- Executing [1234@tutorial:1] NoOp("Message/ast_msg_queue", "Got message") in new stack
-- Executing [1234@tutorial:2] Answer("Message/ast_msg_queue", "") in new stack
-- Executing [1234@tutorial:3] SendText("Message/ast_msg_queue", "Zup dawg") in new stack
-- Executing [1234@tutorial:4] NoOp("Message/ast_msg_queue", "Done with message") in new stack
-- Auto fallthrough, channel 'Message/ast_msg_queue' status is 'UNKNOWN'
BR,
Emil
________________________________________
From: Emil Ohlsson
Sent: Tuesday, September 22, 2015 8:53 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Respond to an out of call SIP MESSAGE
Yes, that is how the problem was solved before when the transport protocol for messages was UDP, but TLS (TCP) this doesn't work. Partly because MessageSend doesn't support SIPS and partly because it focuses on sending a new message instead of reusing an existing stream. Using wireshark I can see that the TLS stream is still alive as there is no tear down communication.
The "same,n," is a good shortcut to make the text more readable, I'll add that but I don't think that is the cause as I can follow the source code and see that the SendText command is executed but fails silently.
Thanks for the feedback,
Emil
________________________________________
From: Matthew Jordan <mjordan@digium.com>
Sent: Monday, September 21, 2015 5:01 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Cc: Emil Ohlsson
Subject: Re: [asterisk-users] Respond to an out of call SIP MESSAGE
On Mon, Sep 21, 2015 at 9:45 AM, D'Arcy J.M. Cain <darcy@vex.net> wrote:
Quote: | On Mon, 21 Sep 2015 06:48:52 +0000
Emil Ohlsson <emo@svep.se> wrote:
Quote: | [sip-im]
exten _X!, 1, NoOp(Got message)
exten _X!, n, Answer()
exten _X!, n, Agi(agi://localhost/messagehandler.agi?...)
exten _X!, n, SendText(Message received)
|
I am not an expert but perhaps you want this.
[sip-im]
exten s,1,NoOp(Got message)
same,n,Answer()
same,n,Agi(agi://localhost/messagehandler.agi?...)
same,n,SendText(Message received)
Replacing "exten _X!" with "same" is just a shortcut. I find that
there are lots of places where spaces cause problems so I just remove
them all for good measure. Finally, I am not sure what the mechanism
is here but if it is like a goto then I think that you want the 's'
priority.
Or, I totally don't know what I am talking about and my education will
be advanced by the replies to this message.
|
If you want to send an out of call SIP MESSAGE request, you'll need to
use the MessageSend application:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+10+Application_MessageSend
SendText is used for sending text messages within a call. Since a SIP
channel is not servicing the out of call text message, you cannot use
it to send a SIP MESSAGE request back to whatever sent the original
SIP MESSAGE request.
--
Matthew Jordan
Digium, Inc. | Director of Technology
445 Jan Davis Drive NW - Huntsville, AL 35806 - USA
Check us out at: http://digium.com & http://asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
jcolp at digium.com Guest
|
Posted: Mon Sep 28, 2015 8:54 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
On 15-09-28 10:19 AM, Emil Ohlsson wrote:
Quote: | (Still no not receiving the mail, revisited the settings.)
OK, so SendText doesn't work with this scenario. But can MessageSend
handle this, and respond even when the transport protocol is TLS? Or
do I need to modify Asterisk to add this support?
|
MessageSend has no concept of TLS, it gets passed to chan_sip which then
sends it. It's therefore up to chan_sip to do it. It should work.
Haven't done it though.
--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
emo at svep.se Guest
|
Posted: Mon Sep 28, 2015 11:39 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
Ah, so I can use
MessageSend(sip:alice)
to send a message to Alice then (reusing the existing TLS session). That does seem to work. Thanks . I didn't know you could use users there.
Is there a variable or some other method to see which user that did send the message? I'm thinking something in the lines of
[context]
exten => _X!,1,NoOp(Handling message from ${SENDER})
I didn't see any useful information using dumpchan, so I'm guessing there isn't any variable for it. $CALLERID(name) didn't contain the name and $SIP_HEADER seems to be focused on calls.
Since the information is in the SIP header it should be possible to get.
/E
________________________________________
From: asterisk-users-bounces@lists.digium.com <asterisk-users-bounces@lists.digium.com> on behalf of Joshua Colp <jcolp@digium.com>
Sent: Monday, September 28, 2015 3:53 PM
To: asterisk-users@lists.digium.com
Subject: Re: [asterisk-users] Respond to an out of call SIP MESSAGE
On 15-09-28 10:19 AM, Emil Ohlsson wrote:
Quote: | (Still no not receiving the mail, revisited the settings.)
OK, so SendText doesn't work with this scenario. But can MessageSend
handle this, and respond even when the transport protocol is TLS? Or
do I need to modify Asterisk to add this support?
|
MessageSend has no concept of TLS, it gets passed to chan_sip which then
sends it. It's therefore up to chan_sip to do it. It should work.
Haven't done it though.
--
Joshua Colp
Digium, Inc. | Senior Software Developer
445 Jan Davis Drive NW - Huntsville, AL 35806 - US
Check us out at: www.digium.com & www.asterisk.org
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
mjordan at digium.com Guest
|
Posted: Tue Sep 29, 2015 7:15 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
On Mon, Sep 28, 2015 at 11:38 AM, Emil Ohlsson <emo@svep.se> wrote:
Quote: | Ah, so I can use
MessageSend(sip:alice)
to send a message to Alice then (reusing the existing TLS session). That does seem to work. Thanks . I didn't know you could use users there.
Is there a variable or some other method to see which user that did send the message? I'm thinking something in the lines of
[context]
exten => _X!,1,NoOp(Handling message from ${SENDER})
I didn't see any useful information using dumpchan, so I'm guessing there isn't any variable for it. $CALLERID(name) didn't contain the name and $SIP_HEADER seems to be focused on calls.
Since the information is in the SIP header it should be possible to get.
|
Since MESSAGE requests are serviced on a single, special channel that
is not a SIP channel, chan_sip specific functions/variables will not
work on that channel.
The MESSAGE_DATA function will read headers off of a received SIP
MESSAGE request:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_MESSAGE_DATA
You can also add headers to an outbound SIP MESSAGE request using that
same function.
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
emo at svep.se Guest
|
Posted: Tue Sep 29, 2015 7:45 am Post subject: [asterisk-users] Respond to an out of call SIP MESSAGE |
|
|
Thanks,
I actually ended up using the MESSAGE(from), which included the sender.
Br,
Emil
________________________________________
From: asterisk-users-bounces@lists.digium.com <asterisk-users-bounces@lists.digium.com> on behalf of Matthew Jordan <mjordan@digium.com>
Sent: Tuesday, September 29, 2015 2:15 PM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] Respond to an out of call SIP MESSAGE
On Mon, Sep 28, 2015 at 11:38 AM, Emil Ohlsson <emo@svep.se> wrote:
Quote: | Ah, so I can use
MessageSend(sip:alice)
to send a message to Alice then (reusing the existing TLS session). That does seem to work. Thanks . I didn't know you could use users there.
Is there a variable or some other method to see which user that did send the message? I'm thinking something in the lines of
[context]
exten => _X!,1,NoOp(Handling message from ${SENDER})
I didn't see any useful information using dumpchan, so I'm guessing there isn't any variable for it. $CALLERID(name) didn't contain the name and $SIP_HEADER seems to be focused on calls.
Since the information is in the SIP header it should be possible to get.
|
Since MESSAGE requests are serviced on a single, special channel that
is not a SIP channel, chan_sip specific functions/variables will not
work on that channel.
The MESSAGE_DATA function will read headers off of a received SIP
MESSAGE request:
https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Function_MESSAGE_DATA
You can also add headers to an outbound SIP MESSAGE request using that
same function.
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users
--
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
http://www.asterisk.org/hello
asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
http://lists.digium.com/mailman/listinfo/asterisk-users |
|
Back to top |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|