Problem with SIP trunk

Hi,

I have problems creating a SIP trunk to the SIP server from my asterisk PBX.
I’m running Asterisk 1.8.17 on CentOS.
I have created a SIP trunk towards SIP server from FreePBX Web GUI with following parameters:
SIP server I’m trying to connect to has outbound proxy different from domain (domain required for registration of the trunk is mydomain.com, and proxy to which I must send SIP signalling is proxy.mydomain.com).

Here is configuration of the trunk:

[quote]PEER Details:

username=45622000111
type=friend
secret=mysecret
host=proxy.mydomain.com
realm=mydomain.com
fromdomain=mydomain.com
outboundproxy=proxy.mydomain.com
insecure=invite[/quote]

Registration and incomming calls work ok, but I’m having problem with outgoing calls from Asterisk to server. When I make a call, Asterisk generates following INVITE towards SIP server:

[quote]INVITE sip:45622000144@proxy.mydomain.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.10:5060;branch=z9hG4bK325ca62b;rport
Max-Forwards: 70
From: “45622000111” sip:45622000111@mydomain.com;tag=as077b9904
To: sip:45622000144@proxy.mydomain.com
Contact: sip:45622000111@192.168.1.10:5060
Call-ID: 15ec57f362ba9199383c47ba67503985@mydomain.com
CSeq: 102 INVITE
User-Agent: FPBX-2.10.1(1.8.17.0)
Date: Thu, 01 Nov 2012 14:36:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 315

v=0
o=root 1280424892 1280424892 IN IP4 10.111.253.246
s=Asterisk PBX 1.8.17.0
c=IN IP4 10.111.253.246
t=0 0
m=audio 17300 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv[/quote]

The problem with this INVITE are lines:
“INVITE sip:45622000144@proxy.mydomain.com SIP/2.0” and “To: sip:45622000144@[b]proxy.mydomain.com[/b]”, because SIP server expects these lines to be:
“INVITE sip:45622000144@mydomain.com SIP/2.0” and “To: sip:45622000144@[b]mydomain.com[/b]”.

Asterisk seems to insert a host parameter from the configuration in domain part of the SIP uri.

The correct INVITE would be:

[quote]INVITE sip:45622000144@mydomain.com SIP/2.0
Via: SIP/2.0/UDP 192.168.1.10:5060;branch=z9hG4bK325ca62b;rport
Max-Forwards: 70
From: “45622000111” sip:45622000111@mydomain.com;tag=as077b9904
To: sip:45622000144@mydomain.com
Contact: sip:45622000111@192.168.1.10:5060
Call-ID: 15ec57f362ba9199383c47ba67503985@mydomain.com
CSeq: 102 INVITE
User-Agent: FPBX-2.10.1(1.8.17.0)
Date: Thu, 01 Nov 2012 14:36:17 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 315

v=0
o=root 1280424892 1280424892 IN IP4 10.111.253.246
s=Asterisk PBX 1.8.17.0
c=IN IP4 10.111.253.246
t=0 0
m=audio 17300 RTP/AVP 0 8 3 101
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:3 GSM/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=silenceSupp:off - - - -
a=ptime:20
a=sendrecv[/quote]

If I change “host=proxy.mydomain.com” into “host=mydomain.com”, INVITE cannot be sent because domain mydomain.com cannot be resolved by DNS (only proxy.mydomain.com is entered into DNS).

Any suggestions regarding this problem?

Thanks in advance,
ismarj

host= is wrong.

If I put “host=mydomain.com”, Asterisk tries to send INVITE to mydomain.com instead of proxy.mydomain.com.
How can I make it send INVITE to proxy.mydomain.com, and to put sip:45622000144@mydomain.com in “To:” and “Status-Line” field?

outboundproxy looks OK. What does sip show peer report?

have you tried setting your localnet and externhost?

Here is display of sip show peer:

[quote]asterisk*CLI> sip show peer imstrunk

  • Name : mytesttrunk
    Secret :
    MD5Secret :
    Remote Secret:
    Context : from-trunk-sip-imstrunk
    Subscr.Cont. :
    Language :
    AMA flags : Unknown
    Transfer mode: open
    CallingPres : Presentation Allowed, Not Screened
    FromDomain : mydomain.com Port 5060
    Callgroup :
    Pickupgroup :
    MOH Suggest :
    Mailbox :
    VM Extension : *97
    LastMsgsSent : 32767/65535
    Call limit : 0
    Max forwards : 0
    Dynamic : No
    Callerid : “” <>
    MaxCallBR : 384 kbps
    Expire : -1
    Insecure : invite
    Force rport : Yes
    ACL : No
    DirectMedACL : No
    T.38 support : No
    T.38 EC mode : Unknown
    T.38 MaxDtgrm: -1
    DirectMedia : Yes
    PromiscRedir : No
    User=Phone : No
    Video Support: No
    Text Support : No
    Ign SDP ver : No
    Trust RPID : No
    Send RPID : No
    Subscriptions: Yes
    Overlap dial : Yes
    Outb. proxy : proxy.mydomain.com
    DTMFmode : rfc2833
    Timer T1 : 500
    Timer B : 32000
    ToHost : mydomain.com
    Addr->IP : 192.168.1.50:5060
    Defaddr->IP : (null)
    Prim.Transp. : UDP
    Allowed.Trsp : UDP
    Def. Username: 45622000111
    SIP Options : timer
    Codecs : 0xe (gsm|ulaw|alaw)
    Codec Order : (ulaw:20,alaw:20,gsm:20)
    Auto-Framing : No
    Status : Unmonitored
    Useragent :
    Reg. Contact :
    Qualify Freq : 60000 ms
    Sess-Timers : Accept
    Sess-Refresh : uas
    Sess-Expires : 1800 secs
    Min-Sess : 90 secs
    RTP Engine : asterisk
    Parkinglot :
    Use Reason : No
    Encryption : No[/quote]

It should use the proxy, unless there is a conflicting Route header. Is it possibly using the proxy for some, but not all, transmissions. If so, the force option may help.

Otherwise, you need to run sip set debug or sip set history, and demonstrate that the proxy is actually being ignored.