[asterisk-dev] Enable SIP keepalive (OPTIONS?) for calls from unregistered but authenticated peers

Johan Sandgren jsa at svep.se
Mon Jun 3 04:30:49 CDT 2013


Hi everyone,

I need activate SIP keepalives "OPTIONS"-packet (over UDP) for unregistered, but authenticated calls into asterisk.
I have played with the sip.conf settings but have not been able to enable any SIP keepalives when not registered when calling with SIP into Asterisk.
So I decided to go into the source code to modify it to send then even for unregistered calls.

I'm using the registered case, to trace runtime where the code is executing when it's sending the OPTIONS packets every now (every 60s?).
I have tried to trace the code to see what triggers the call to the function "sip_poke_peer_s" but have not been able to see how, or where the 60sec timer is.

Can someone give me info on what triggers it?
And, am I on to a solution when I want to "enable" triggering of this function will send OPTION packets to active call-dialogues (ie in my case my unregistrered but authenticated ongoing call?) ?
Or should I do something else?

Attaching some log for you to see what I've got so far.

 [May 31 18:15:30] WARNING[10118]: chan_sip.c:7595 sip_read: sip_read:sip_read:chan_sip.c
[May 31 18:15:30] WARNING[10118]: chan_sip.c:6636 sip_write: sip_write:sip_write:chan_sip.c
[May 31 18:15:30] WARNING[10062]: chan_sip.c:13989 print_callstack: print_callstack: 7		; This is to try tracing where the call to "sip_poke_peer_s()" came from, not there just yet.
[May 31 18:15:30] WARNING[10062]: chan_sip.c:14003 print_callstack: /usr/lib/asterisk/modules/chan_sip.so(+0x10cad) [0xb6f18cad]
[May 31 18:15:30] WARNING[10062]: chan_sip.c:14003 print_callstack: /usr/lib/asterisk/modules/chan_sip.so(+0x51b1d) [0xb6f59b1d]
[May 31 18:15:30] WARNING[10062]: chan_sip.c:14003 print_callstack: /usr/sbin/asterisk(ast_sched_runq+0x13b) [0x8185e96]
[May 31 18:15:30] WARNING[10062]: chan_sip.c:14003 print_callstack: /usr/lib/asterisk/modules/chan_sip.so(+0x60cec) [0xb6f68cec]
[May 31 18:15:30] WARNING[10062]: chan_sip.c:14003 print_callstack: /usr/sbin/asterisk() [0x819d58e]
[May 31 18:15:30] WARNING[10062]: chan_sip.c:14003 print_callstack: /lib/i686/cmov/libpthread.so.0(+0x5955) [0xb7463955]
[May 31 18:15:30] WARNING[10062]: chan_sip.c:14003 print_callstack: /lib/i686/cmov/libc.so.6(clone+0x5e) [0xb76fe1de]
[May 31 18:15:30] WARNING[10062]: chan_sip.c:14031 sip_poke_peer_s: poke call				; This one is what I want to know who called, where's the timer? The code is hard to follow here.
[May 31 18:15:30] WARNING[10062]: chan_sip.c:26835 sip_poke_peer: sip_poke_peer()
 [May 31 18:15:30] WARNING[10062]: chan_sip.c:7784 sip_alloc: sip_alloc:sip_alloc:chan_sip.c
 [May 31 18:15:30] WARNING[10062]: chan_sip.c:3118 initialize_initreq: initialize_initreq:initialize_initreq:chan_sip.c
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:3122 initialize_initreq: Initializing initreq for method OPTIONS - callid 52c23df1087536651797666d72b1d2b7 at 10.40.0.1:5060
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  0 [ 57]: OPTIONS sip:ip1 at 10.99.99.99:5060;transport=UDP;ob SIP/2.0
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  1 [ 60]: Via: SIP/2.0/UDP 10.40.0.1:5060;branch=z9hG4bK7a2f48d0;rport
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  2 [ 16]: Max-Forwards: 70
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  3 [ 56]: From: "asterisk" <sip:asterisk at 10.40.0.1>;tag=as66da95f6
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  4 [ 47]: To: <sip:ip1 at 10.99.99.99:5060;transport=UDP;ob>
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  5 [ 38]: Contact: <sip:asterisk at 10.40.0.1:5060>
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  6 [ 56]: Call-ID: 52c23df1087536651797666d72b1d2b7 at 10.40.0.1:5060
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  7 [ 17]: CSeq: 102 OPTIONS
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  8 [ 31]: User-Agent: Asterisk PBX 10.0.0
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header  9 [ 35]: Date: Fri, 31 May 2013 16:15:30 GMT
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header 10 [ 81]: Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
[May 31 18:15:30] DEBUG[10062]: chan_sip.c:8765 parse_request:  Header 11 [ 26]: Supported: replaces, timer
[May 31 18:15:30] WARNING[10062]: chan_sip.c:4259 send_request: send_request:send_request:chan_sip.c
[May 31 18:15:30] WARNING[10062]: chan_sip.c:3238 sip_debug_test_addr: sip_debug_test_addr:sip_debug_test_addr:chan_sip.c
Reliably Transmitting (NAT) to 10.99.99.99:5060:
OPTIONS sip:ip1 at 10.99.99.99:5060;transport=UDP;ob SIP/2.0
Via: SIP/2.0/UDP 10.40.0.1:5060;branch=z9hG4bK7a2f48d0;rport
Max-Forwards: 70
From: "asterisk" <sip:asterisk at 10.40.0.1>;tag=as66da95f6
To: <sip:ip1 at 10.99.99.99:5060;transport=UDP;ob>
Contact: <sip:asterisk at 10.40.0.1:5060>
Call-ID: 52c23df1087536651797666d72b1d2b7 at 10.40.0.1:5060
CSeq: 102 OPTIONS
User-Agent: Asterisk PBX 10.0.0
Date: Fri, 31 May 2013 16:15:30 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Length: 0


---


Cheers,
Johan

===================================================


Johan Sandgren
Software Engineer
Svep Design Center AB
S:t Lars väg 42A
222 70 Lund, Sweden
Phone +46 46 192 722
E-mail  jsa at svep.se
Website www.svep.se



More information about the asterisk-dev mailing list