Michael Shuler
2004-Nov-14 12:40 UTC
[Asterisk-Users] Asterisk using the wrong peer in sip.conf
I'm having a problem with Asterisk choosing the wrong peer entry from the sip.conf file. Based off the debug below Asterisk should see the message coming from TNT3 (see the sip.conf below) and not from SER_FAX (which it shows in the debug below "Found peer 'SER_FAX'"). Based off what I have here it seems to me that since the From is 198.88.216.30 it should match with the TNT3 entry in my sip.conf which is what I want it to do, instead it is matching with the SIP proxy that is proxying it the SIP message. Is there a way to get Asterisk to lookup based of the originator of the INVITE instead of by who last proxied it the INVITE? Basically here is my setup: 198.88.216.84 = SER 198.88.216.30 = TNT3 (My PSTN Gateway) 198.88.216.85 = Asterisk TNT3 <---> SER Proxy <---> Asterisk ----- Here is the debug from Asterisk: Sip read: INVITE sip:4444444444@ast.bwsys.net:5060;user=phone SIP/2.0 Record-Route: <sip:4444444444@198.88.216.84:5060;ftag=46cae657-1bf8d0c3-1ed858c6;lr=on> To: <sip:4444444444@198.88.216.84:5060;user=phone> From: <sip:5555555555@198.88.216.30:5060;user=phone>;tag=46cae657-1bf8d0c3-1ed858c 6 Remote-Party-Id: <sip:5555555555@198.88.216.30:5060;user=phone>;screen=yes;id-type=subscriber ;party=calling;privacy=off Proxy-Require: privacy Call-ID: 83221e88-236af-1bf8d0c3@198.88.216.30 CSeq: 93145626 INVITE Via: SIP/2.0/UDP 198.88.216.84;branch=z9hG4bK4aca.dc7b3842.0 Via: SIP/2.0/UDP 198.88.216.30:5060;rport=5060 Max-Forwards: 69 Contact: <sip:5555555555@198.88.216.30:5060;user=phone> Supported: replaces Supported: 100rel Content-Type: application/sdp Content-Length: 272 v=0 o=TNT3 469291203 469291203 IN IP4 198.88.216.30 s=Session SDP c=IN IP4 198.88.216.30 t=0 0 m=audio 44518 RTP/AVP 18 0 8 96 a=silenceSupp:off a=ecan:b on g168 a=rtpmap:96 telephone-event/8000 a=rtpmap:8 PCMA/8000 a=rtpmap:0 PCMU/8000 a=rtpmap:18 G729/8000 16 headers, 12 lines Using latest request as basis request Sending to 198.88.216.84 : 5060 (non-NAT) Found RTP audio format 18 Found RTP audio format 0 Found RTP audio format 8 Found RTP audio format 96 Peer audio RTP is at port 198.88.216.30:44518 Found description format telephone-event Found description format PCMA Found description format PCMU Found description format G729 Capabilities: us - 0x10c(ULAW|ALAW|G729A), peer - audio=0x10c(ULAW|ALAW|G729A)/video=0x0(EMPTY), combined - 0x10c(ULAW|ALAW|G729A) Non-codec capabilities: us - 0x1(G723), peer - 0x1(G723), combined - 0x1(G723) Found peer 'SER_FAX' Looking for 4444444444 in FROM_PSTN list_route: hop: <sip:4444444444@198.88.216.84:5060;ftag=46cae657-1bf8d0c3-1ed858c6;lr=on> list_route: hop: <sip:5555555555@198.88.216.30:5060;user=phone> Transmitting (NAT): SIP/2.0 100 Trying Via: SIP/2.0/UDP 198.88.216.84;branch=z9hG4bK4aca.dc7b3842.0;received=198.88.216.84;rport=506 0 Via: SIP/2.0/UDP 198.88.216.30:5060 From: <sip:5555555555@198.88.216.30:5060;user=phone>;tag=46cae657-1bf8d0c3-1ed858c 6 To: <sip:4444444444@198.88.216.84:5060;user=phone>;tag=as62f171b3 Call-ID: 83221e88-236af-1bf8d0c3@198.88.216.30 CSeq: 93145626 INVITE User-Agent: Asterisk PBX Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER Contact: <sip:4444444444@198.88.216.85> Content-Length: 0 ----- Here is my sip.conf: [general] port=5060 ; Port to bind to bindaddr=0.0.0.0 ; Address to bind to context=FROM_PSTN ; Default for incoming calls rtptimeout=30 ; Terminate call if 60 seconds of no RTP activity canreinvite=no disallow=all allow=g729 allow=ulaw allow=alaw [SER] type=friend host=198.88.216.84 port=5060 qualify=no nat=yes disallow=all allow=g729 allow=ulaw allow=alaw [SER_FAX] type=friend host=198.88.216.84 port=5060 qualify=no nat=yes disallow=all allow=ulaw [TNT3] type=friend host=198.88.216.30 port=5060 dtmfmode=rfc2833 qualify=no canreinvite=no nat=no context=FROM_PSTN deny=0.0.0.0 permit=198.88.216.30/255.255.255.255 disallow=all allow=g729 allow=ulaw allow=alaw ---------------------------------------- Michael Shuler
Olle E. Johansson
2004-Nov-14 14:21 UTC
[Asterisk-Users] Asterisk using the wrong peer in sip.conf
First, please do not use "friends". It will confuse you. We receive calls from type=user and send calls to type=peer (that is the general idea, anyway... :-) For an incoming call, we first match on users based on the username part of the From: sip address. So if the call comes from sip:oej@edvina.net, we'll match on "oej". If we can't find a matching user, we will match on peers based on IP address, which is your problem. Make sure you have a type=user with the correct user name and you should be all set. /O