[Home]

Summary:ASTERISK-00365: SIP doesn't honor "anti-exgirlfriend" extension
Reporter:thansen (thansen)Labels:
Date Opened:2003-10-08 12:55:52Date Closed:2008-01-15 14:35:57.000-0600
Priority:MajorRegression?No
Status:Closed/CompleteComponents:Core/General
Versions:Frequency of
Occurrence
Related
Issues:
Environment:Attachments:
Description:I've used the following extension with Zap and H323:

exten => 1234/4567,1,Hangup();

This would hangup the channel if a call to 1234 comes from 4567.

SIP doesn't honor this. In fact, it can't even find the 1234 extension.
Comments:By: John Todd (jtodd) 2003-10-08 15:56:11

So you're saying that this simplified dial command won't work, either, if you dial 1234?

exten => 1234,1,Hangup();

PS: You can drop the ";"  at the end of the line.   In fact, hangup doesn't even need the parenthesis. Try this:

exten => 1234,1,Hangup

By: Brian West (bkw918) 2003-10-08 17:51:08

Also depends on if the sip endpoint is sending the correct callerid.

By: thansen (thansen) 2003-10-09 02:04:35

jtodd:
No no, SIP finds the extension if I remove the '/4567' part.

I know that neither the paranthesis nor the ';' is required. It's just a programming habit. :)


bkw918:
I'm pretty sure the SIP endpoint sends the correct callerid, as it shows up correctly on an external phone when dialing through ZAP/PRI and an external telco. How can I be 100% sure? Anything specific in the SIP DEBUG output I can check?

By: John Todd (jtodd) 2003-10-09 02:57:31

You can be sure by using "sip debug" when you attempt a call, and include the output in a bugnote.

By: thansen (thansen) 2003-10-09 03:15:03

As requested:

The extension which should catch it:
[cxnet-in]
exten => 2/88348496,1,Goto(cxnet-out|88348490|1)

SIP DEBUG output:
Sip read:
INVITE sip:2@as.as.as.as;user=phone SIP/2.0
Call-ID: 522e4-36bbac8-c387ec0a@ep.ep.ep.ep
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2a2c4-36bbacf
To: <sip:2@as.as.as.as;user=phone>
CSeq: 100 INVITE
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
Contact: 88348496<sip:88348496@ep.ep.ep.ep:5061;user=phone>
Max-Forwards: 70
User-Agent: Telsey ver3_06_08
Supported: timer
Allow: REFER,UPDATE,INFO,OPTIONS
Content-Type: application/sdp
Content-Length: 159

v=0
o=88348496 0 0 IN IP4 ep.ep.ep.ep
s=-
c=IN IP4 ep.ep.ep.ep
t=0 0
m=audio 10002 RTP/AVP 8 0 100
a=ptime:20
a=rtpmap:100 telephone-events/8000

13 headers, 8 lines
Using latest request as basis request
Sending to ep.ep.ep.ep : 5061 (non-NAT)
Found audio format ALAW
Found audio format UNKN
Found audio format UNKN
Found description format telephone-events
Capabilities: us - 8, them - 12/0, combined - 8
Non-codec capabilities: us - 1, them - 0, combined - 0
Looking for 2 in cxnet-in
Transmitting (no NAT):
SIP/2.0 484 Address Incomplete
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2a2c4-36bbacf
To: <sip:2@as.as.as.as;user=phone>;tag=as409ce062
Call-ID: 522e4-36bbac8-c387ec0a@ep.ep.ep.ep
CSeq: 100 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:@as.as.as.as>
Content-Length: 0


to ep.ep.ep.ep:5061
Sip read:
ACK sip:2@as.as.as.as;user=phone SIP/2.0
Call-ID: 522e4-36bbac8-c387ec0a@ep.ep.ep.ep
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2a2c4-36bbacf
To: <sip:2@as.as.as.as>;tag=as409ce062
CSeq: 100 ACK
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
Content-Length: 0


7 headers, 0 lines

By: Brian West (bkw918) 2003-10-09 09:51:02

I think this only works with s extensions doesnt it?  Thats how the example is.

bkw

By: thansen (thansen) 2003-10-09 09:56:49

The extension mentioned above works with H323, OH323 and ZAP.

By: Mark Spencer (markster) 2003-10-09 21:04:20

This should be fixed now.  Can you confirm?

By: thansen (thansen) 2003-10-10 05:43:32

No, it still doesn't work. :(

By: thansen (thansen) 2003-10-10 09:36:21

I've added a bunch of variable dumps which might help figuring out what goes wrong... Particularly cidpattern/callerid in pbx.c:matchcid():


Sip read:
INVITE sip:1@as.as.as.as;user=phone SIP/2.0
Call-ID: 53148-c13973-c387ec58@ep.ep.ep.ep
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2b128-c1397a
To: <sip:1@as.as.as.as;user=phone>
CSeq: 100 INVITE
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
Contact: 88348496<sip:88348496@ep.ep.ep.ep:5061;user=phone>
Max-Forwards: 70
User-Agent: Telsey ver3_06_08
Supported: timer
Allow: REFER,UPDATE,INFO,OPTIONS
Content-Type: application/sdp
Content-Length: 161

v=0
o=88348496 0 0 IN IP4 ep.ep.ep.ep
s=-
c=IN IP4 ep.ep.ep.ep
t=0 0
m=audio 10002 RTP/AVP 8 0 100
a=ptime:20
a=rtpmap:100 telephone-events/8000

13 headers, 8 lines
Using latest request as basis request
Sending to ep.ep.ep.ep : 5061 (non-NAT)
Found audio format ALAW
Found audio format UNKN
Found audio format UNKN
Found description format telephone-events
Capabilities: us - 8, them - 12/0, combined - 8
Non-codec capabilities: us - 1, them - 0, combined - 0
tmp: sip:1@as.as.as.as
c: sip:1@as.as.as.as
tmpf: 88348496<sip:88348496@as.as.as.as;user=phone
fr: sip:88348496@as.as.as.as;user=phone
Looking for 1 in cxnet-in
   -- cidpattern: 88348496
   -- callerid: sip:88348496@as.as.as.as;user=phone
   -- cidpattern: 88348496
   -- callerid: sip:88348496@as.as.as.as;user=phone
ast_canmatch_extension()
Transmitting (no NAT):
SIP/2.0 484 Address Incomplete
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2b128-c1397a
To: <sip:1@as.as.as.as;user=phone>;tag=as3e253280
Call-ID: 53148-c13973-c387ec58@ep.ep.ep.ep
CSeq: 100 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:@as.as.as.as>
Content-Length: 0


to ep.ep.ep.ep:5061
Sip read:
ACK sip:1@as.as.as.as;user=phone SIP/2.0
Call-ID: 53148-c13973-c387ec58@ep.ep.ep.ep
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2b128-c1397a
To: <sip:1@as.as.as.as>;tag=as3e253280
CSeq: 100 ACK
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
Content-Length: 0


7 headers, 0 lines

By: Mark Spencer (markster) 2003-10-10 13:41:50

Okay should be fixed now try again

By: thansen (thansen) 2003-10-11 10:50:46

Sorry, no such luck. Here's another bunch of output to help. Seems to me like "@asasasas;user=phone" should be stripped from "88348496@asasasas;user=phone" before calling ast_isphonenumber().


gw-2*CLI> extensions reload
 == Parsing '/etc/asterisk/extensions.conf':   == Parsing '/etc/asterisk/extensions.conf': Found
   -- Registered extension context 'cxnet-in'
   -- Added extension '1' priority 1 (CID match '88348496')to cxnet-in
Sip read:
INVITE sip:1@as.as.as.as;user=phone SIP/2.0
Call-ID: 52394-4fc222-c387ec58@ep.ep.ep.ep
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2a374-4fc229
To: <sip:1@as.as.as.as;user=phone>
CSeq: 100 INVITE
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
Contact: 88348496<sip:88348496@ep.ep.ep.ep:5061;user=phone>
Max-Forwards: 70
User-Agent: Telsey ver3_06_08
Supported: timer
Allow: REFER,UPDATE,INFO,OPTIONS
Content-Type: application/sdp
Content-Length: 161

v=0
o=88348496 0 0 IN IP4 ep.ep.ep.ep
s=-
c=IN IP4 ep.ep.ep.ep
t=0 0
m=audio 10002 RTP/AVP 8 0 100
a=ptime:20
a=rtpmap:100 telephone-events/8000

13 headers, 8 lines
Using latest request as basis request
Sending to ep.ep.ep.ep : 5061 (non-NAT)
Found audio format ALAW
Found audio format UNKN
Found audio format UNKN
Found description format telephone-events
Capabilities: us - 8, them - 12/0, combined - 8
Non-codec capabilities: us - 1, them - 0, combined - 0
Looking for 1 in cxnet-in
   -- pbx.c:ast_exists_extension()
   -- pbx.c:pbx_extension_helper()
   -- pbx.c:pbx_find_extension()
   -- pbx.c:pbx_find_extension().eroot->exten: 1
   -- pbx.c:ast_extension_match().pattern: 1
   -- pbx.c:ast_extension_match().data: 1
   -- pbx.c:matchcid().cidpattern: 88348496
   -- pbx.c:matchcid().callerid: 88348496@as.as.as.as;user=phone
   -- callerid.c:ast_callerid_parse().instr: 88348496@as.as.as.as;user=phone
   -- callerid.c:ast_shrink_phone_number().n(before): 88348496@as.as.as.as;user=phone
   -- callerid.c:ast_shrink_phone_number().n(after): 88348496@asasasas;user=phone
   -- callerid.c:ast_isphonenumber().n: 88348496@asasasas;user=phone
   -- callerid.c:ast_isphonenumber().strchr.failed.returning.0
   -- callerid.c:ast_callerid_parse().assuming_name
   -- callerid.c:ast_callerid_parse().name: 88348496@as.as.as.as;user=phone
   -- callerid.c:ast_callerid_parse().location: (null)
   -- callerid.c:ast_callerid_parse().return 0
   -- pbx.c:matchcid().!num = true.returning.failresult
   -- pbx.c:pbx_find_extension().return NULL
   -- pbx.c:pbx_extension_helper().sw&e = false
   -- pbx.c:pbx_extension_helper().switch(status).STATUS_NO_EXTENSION
   -- pbx.c:ast_canmatch_extension()
   -- pbx.c:pbx_extension_helper()
   -- pbx.c:pbx_find_extension()
   -- pbx.c:pbx_find_extension().eroot->exten: 1
   -- pbx.c:ast_extension_match().pattern: 1
   -- pbx.c:ast_extension_match().data: 1
   -- pbx.c:matchcid().cidpattern: 88348496
   -- pbx.c:matchcid().callerid: 88348496@as.as.as.as;user=phone
   -- callerid.c:ast_callerid_parse().instr: 88348496@as.as.as.as;user=phone
   -- callerid.c:ast_shrink_phone_number().n(before): 88348496@as.as.as.as;user=phone
   -- callerid.c:ast_shrink_phone_number().n(after): 88348496@asasasas;user=phone
   -- callerid.c:ast_isphonenumber().n: 88348496@asasasas;user=phone
   -- callerid.c:ast_isphonenumber().strchr.failed.returning.0
   -- callerid.c:ast_callerid_parse().assuming_name
   -- callerid.c:ast_callerid_parse().name: 88348496@as.as.as.as;user=phone
   -- callerid.c:ast_callerid_parse().location: (null)
   -- callerid.c:ast_callerid_parse().return 0
   -- pbx.c:matchcid().!num = true.returning.failresult
   -- pbx.c:pbx_find_extension().return NULL
   -- pbx.c:pbx_extension_helper().sw&e = false
   -- pbx.c:pbx_extension_helper().switch(status).STATUS_NO_EXTENSION
Transmitting (no NAT):
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2a374-4fc229
To: <sip:1@as.as.as.as;user=phone>;tag=as31781520
Call-ID: 52394-4fc222-c387ec58@ep.ep.ep.ep
CSeq: 100 INVITE
User-Agent: Asterisk PBX
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER
Contact: <sip:@as.as.as.as>
Content-Length: 0


to ep.ep.ep.ep:5061
Sip read:
ACK sip:1@as.as.as.as;user=phone SIP/2.0
Call-ID: 52394-4fc222-c387ec58@ep.ep.ep.ep
From: 88348496<sip:88348496@as.as.as.as;user=phone>;tag=2a374-4fc229
To: <sip:1@as.as.as.as>;tag=as31781520
CSeq: 100 ACK
Via: SIP/2.0/UDP ep.ep.ep.ep:5061
Content-Length: 0


7 headers, 0 lines

By: Mark Spencer (markster) 2003-10-12 06:18:56

And now??

By: Mark Spencer (markster) 2003-10-12 06:18:58

And now??

By: thansen (thansen) 2003-10-12 06:32:04

You fixed it! Great! Thanks!!

By: Mark Spencer (markster) 2003-10-13 06:56:15

Fixed in CVS

By: Digium Subversion (svnbot) 2008-01-15 14:35:57.000-0600

Repository: asterisk
Revision: 1623

U   trunk/channels/chan_sip.c

------------------------------------------------------------------------
r1623 | markster | 2008-01-15 14:35:57 -0600 (Tue, 15 Jan 2008) | 2 lines

Consider "from" when getting destination (bug ASTERISK-365)

------------------------------------------------------------------------

http://svn.digium.com/view/asterisk?view=rev&revision=1623