Context Ignogring

Hello!
I have installed Asterisk 1.6.2.9-2 on Debian Linux. Configured it( as I suppose correct). But Asterisk ignore context.
ie. I have following sip.conf

register =>  1262454204:password1@sip.prov.kz
register =>  2035503233:password2@sip.prov.kz/phL2

[CUCM]
type=friend
host=192.168.168.96
nat=no
insecure=yes
canreinvite=no
qualify=yes
disallow=all
allow=g729,alaw
context=provOUT
dtmfmode=auto
directmedia=no
t38pt_udptl=yes

[phL1]
type=friend
context=provIN
defaultuser=2035503233
fromuser=2035503233
secret=password1
fromdomain=sip.prov.kz
host=sip.prov.kz
call-limit=2
dtmfmode=rfc2833
insecure=port,invite
directmedia=no
registersip=yes
disallow=all
allow=alaw,g729
nat=yes
t38pt_udptl=yes

[phL2]
type=friend
context=provIN
defaultuser=1262454204
fromuser=1262454204
secret=password2
fromdomain=sip.prov.kz
host=sip.prov.kz
insecure=invite,port
directmedia=no
call-limit=2
dtmfmode=rfc2833
registersip=yes
disallow=all
allow=alaw,g729

In extensions.conf

[nope]
exten => s,1,HangUP

[provIN]
exten => s,1,Dial(SIP/CUCM/192)

[provOUT]
exten => _98717[23]XXXXXX,1, Dial(SIP/phL1/${EXTEN:5},120,rm)
exten => _98717[23]XXXXXX,n, GotoIf($[${DIALSTATUS}=CHANUNAVAIL]?tru2)
exten => _98717[23]XXXXXX,n, Hangup()
exten => _98717[23]XXXXXX,n(tru2), Dial(SIP/phL2/${EXTEN:5},120,rm)
exten => Playback(Busy)
exten => _98717[23]XXXXXX,n, Hangup()

If in sip.conf default context nope then calls from CUCM are not accepted, message is not found. In SIP peer details(sip show peer CUCM) context is correct (provOUT). The same problem with phL1 and phL2. phL1 do “not see” context, when phL2 work correct. I know that now little mistake with phL1, but there is problem too.
If I am changing register => 1262454204:password1@sip.prov.kz to register => 1262454204:password1@sip.prov.kz/phL1 then incoming extensions are not found. But if register => 1262454204:password1@sip.prov.kz, then calls are accepted through 2nd line. Any Ideas ?

Your configuration files show ProvIN.

Also note that having two devices with the same host address can cause problems, especially if insecure=invite is justified.

two devices phL1 and phL2 are in provIN context, CUCM provOUT. Where mention about provIN for CUCM?

Sorry. I missed CUCM.

The most likely reason for this sort of problem is that the incoming call is not being matched against the CUCM entry. To confirm this, you would need at least verbose console log output. Potentially you may need sip set debug output.

You are quite right,

 == Using SIP RTP CoS mark 5
  == Using UDPTL CoS mark 5
Sending to 192.168.168.96 : 5060 (no NAT)
Found RTP audio format 18
Found RTP audio format 8
Found RTP audio format 101
Found audio description format G729 for ID 18
Found audio description format PCMA for ID 8
Found audio description format telephone-event for ID 101
Capabilities: us - 0x40c (ulaw|alaw|ilbc), peer - audio=0x108 (alaw|g729)/video=0x0 (nothing)/text=0x0 (nothing), combined - 0x8 (alaw)
Non-codec capabilities (dtmf): us - 0x1 (telephone-event), peer - 0x1 (telephone-event), combined - 0x1 (telephone-event)
Peer audio RTP is at port 192.168.168.96:17162
Looking for 987272222222 in default (domain 172.16.17.148)

<--- Reliably Transmitting (no NAT) to 192.168.168.96:5060 --->
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.168.96:5060;branch=z9hG4bK29A1A9D;received=192.168.168.96
From: "Alexandr " <sip:113@192.168.168.96>;tag=61FBA98-11DF
To: <sip:987172222222@172.16.17.148>;tag=as09632286
Call-ID: BE4AFC90-D13911DF-8F009257-79A3AE2A@192.168.168.96
CSeq: 101 INVITE
Server: SipperLite
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog 'BE4AFC90-D13911DF-8F009257-79A3AE2A@192.168.168.96' in 32000 ms (Method: INVITE)
Really destroying SIP dialog 'BE4AFC90-D13911DF-8F009257-79A3AE2A@192.168.168.96' Method: ACK

same thing with phL1, how it could be?
how debug peer searching ?

I always get confused by the exact rules, when there are possibilities of both name and address matches, so I don’t think I can give a quick, reliable, answer.

However, you may want to set allowguest to no, to improve the system security.

strange but allowguest only make confirmation, that asterisk do not identify peer .

htel-spirit*CLI>
  == Using SIP RTP CoS mark 5
  == Using UDPTL CoS mark 5
Sending to 192.168.168.96 : 5060 (no NAT)

<--- Reliably Transmitting (no NAT) to 192.168.168.96:5060 --->
SIP/2.0 403 Forbidden
Via: SIP/2.0/UDP 192.168.168.96:5060;branch=z9hG4bK2AE1FF1;received=192.168.168.96
From: "Alexandr " <sip:113@192.168.168.96>;tag=6363D24-21E5
To: <sip:987172222222@172.16.17.148>;tag=as4725c493
Call-ID: 2D9C026E-D13D11DF-8F609257-79A3AE2A@192.168.168.96
CSeq: 101 INVITE
Server: SipperLite
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
Supported: replaces, timer
Content-Length: 0


<------------>
Scheduling destruction of SIP dialog '2D9C026E-D13D11DF-8F609257-79A3AE2A@192.168.168.96' in 32000 ms (Method: INVITE)
Really destroying SIP dialog '2D9C026E-D13D11DF-8F609257-79A3AE2A@192.168.168.96' Method: ACK

That’s what I would have expected. The suggestion was made to ensure that intruders were blocked as early as possible, rather than to ensure you matched the correct entry.

I am understand. What debug I can use to find out what happening? Where can problem be?

This statement in your [provOUT] is not correct. Perhaps is causing dialplan problems…

Hi

It looks like the incoming call is matching against teh default context [quote]Looking for 987272222222 in default [/quote]

you need to set a context in your general section of the sip.conf

dialplan show default
and
dialplan show provOUT

etc will show you whas what

Ian

Ian: he’s already accepted that it is matching the default context. What he is after now is why it isn’t matching the CUCM entry in sip.conf. I don’t do this often enough to remember all the subtlteties.

yes, why CUCM do not mached, and why incomig call to phL1 do not matched too, but for phL2 is matched.

Hi why would it match CUCM

its coming from To: sip:987172222222@172.16.17.148; and you say CUCM is host=192.168.168.96
so it wont match

(DISCLAIMER , The following answer was based resoning after on 3 hours in teh pub)

Ian, I do not understand you. Call coming from host 192.168.168.96 , To: sip:987172222222@172.16.17.148 where 172.16.17.148 - asterisk ip, 987172222222 - called number which represented in provOUT context. It should be matched because in sip.conf friend called CUCM has host=192.168.168.96. :unamused:
Found : If in peer CUCM set insecure=port,invite, then Asterisk start find in correct context. Is it correct behavior?
ie. I came to next, I should identify peer by it IP address.