Wrong Request-URI Host in outbound INVITE

Hi guys,

I’m setting up (for a 2nd time) my asteriskNow server. I have a few SIP phones with a single trunk to my SIP Provider. The first time around, a few months back, it all worked out fine.

This time, my inbound calls are fine, but I can’t generate outbound calls.

The problem I see is that my outbound calls INVITE Request-URI Host has my own IP address (96.71.145.239) instead of my Provider’s (159.18.161.67):

INVITE sip:6478691125@96.71.145.239:5060 SIP/2.0
So when my INVITE reaches the Provider, they route the invite right back to me, instead of connecting my call.

No. Time Source Destination Protocol Info 4 *REF* 96.71.145.239 159.18.161.67 SIP/SDP Request: INVITE sip:6478691125@96.71.145.239:5060, with session description 5 0.065184 159.18.161.67 96.71.145.239 SIP Status: 100 Giving a try 6 0.069175 159.18.161.67 96.71.145.239 SIP/SDP Request: INVITE sip:6478691125@96.71.145.239:5060, with session description 7 0.069356 96.71.145.239 159.18.161.67 SIP Status: 100 Trying 8 0.070812 96.71.145.239 159.18.161.67 SIP Request: CANCEL sip:6478691125@96.71.145.239:5060 9 0.141846 159.18.161.67 96.71.145.239 SIP Request: CANCEL sip:6478691125@96.71.145.239:5060 10 0.141987 96.71.145.239 159.18.161.67 SIP Status: 487 Request Terminated 11 0.142039 96.71.145.239 159.18.161.67 SIP Status: 200 OK 12 0.142573 159.18.161.67 96.71.145.239 SIP Status: 200 canceling 13 1.141913 96.71.145.239 159.18.161.67 SIP Status: 487 Request Terminated

The rest of the SIP packet looks just right. The message header To: section is correct and has my Provider’s IP:

To: <sip:6478691125@159.18.161.67> SIP to address: sip:6478691125@159.18.161.67 SIP to address User Part: 6478691125 SIP to address Host Part: 159.18.161.67

Why would the Request-URI differ from the To: header? What I’m I configuring wrong or not configuring?
Its a pretty basic installation.

All I have for my trunk config is (which worked the first time):

disallow=all allow=ulaw dtmfmode=rfc2833 fromdomain=vp.thinktel.ca host=159.18.161.67 insecure=invite,port type=friend nat=yes

The full text of the an initial INVITE decoded packet follows:

No.     Time        Source                Destination           Protocol Info
     13 6.307536    96.71.145.239        159.18.161.67         SIP/SDP  Request: INVITE sip:6478691125@96.71.145.239:5060, with session description

Frame 13 (828 bytes on wire, 828 bytes captured)
    Arrival Time: Oct 30, 2010 14:53:42.786416000
    [Time delta from previous captured frame: 1.869409000 seconds]
    [Time delta from previous displayed frame: 2.873301000 seconds]
    [Time since reference or first frame: 6.307536000 seconds]
    Frame Number: 13
    Frame Length: 828 bytes
    Capture Length: 828 bytes
    [Frame is marked: False]
    [Protocols in frame: sll:ip:udp:sip:sdp]
    [Coloring Rule Name: UDP]
    [Coloring Rule String: udp]
Linux cooked capture
    Packet type: Sent by us (4)
    Link-layer address type: 512
    Link-layer address length: 0
    Source: <MISSING>
    Protocol: IP (0x0800)
Internet Protocol, Src: 96.71.145.239 (96.71.145.239), Dst: 159.18.161.67 (159.18.161.67)
    Version: 4
    Header length: 20 bytes
    Differentiated Services Field: 0x60 (DSCP 0x18: Class Selector 3; ECN: 0x00)
        0110 00.. = Differentiated Services Codepoint: Class Selector 3 (0x18)
        .... ..0. = ECN-Capable Transport (ECT): 0
        .... ...0 = ECN-CE: 0
    Total Length: 812
    Identification: 0x3ac0 (15040)
    Flags: 0x00
        0.. = Reserved bit: Not Set
        .0. = Don't fragment: Not Set
        ..0 = More fragments: Not Set
    Fragment offset: 0
    Time to live: 64
    Protocol: UDP (0x11)
    Header checksum: 0x1bb1 [correct]
        [Good: True]
        [Bad : False]
    Source: 96.71.145.239 (96.71.145.239)
    Destination: 159.18.161.67 (159.18.161.67)
User Datagram Protocol, Src Port: sip (5060), Dst Port: sip (5060)
    Source port: sip (5060)
    Destination port: sip (5060)
    Length: 792
    Checksum: 0x35e9 [validation disabled]
        [Good Checksum: False]
        [Bad Checksum: False]
Session Initiation Protocol
    Request-Line: INVITE sip:6478691125@96.71.145.239:5060 SIP/2.0
        Method: INVITE
        Request-URI: sip:6478691125@96.71.145.239:5060
            Request-URI User Part: 6478691125
            Request-URI Host Part: 96.71.145.239
            Request-URI Host Port: 5060
        [Resent Packet: False]
    Message Header
        Via: SIP/2.0/UDP 96.71.145.239:5060;branch=z9hG4bK11cac908;rport
            Transport: UDP
            Sent-by Address: 96.71.145.239
            Sent-by port: 5060
            Branch: z9hG4bK11cac908
            RPort: rport
        From: "6473172818" <sip:6473172818@vp.thinktel.ca>;tag=as76a0018a
            SIP Display info: "6473172818" 
            SIP from address: sip:6473172818@vp.thinktel.ca
                SIP from address User Part: 6473172818
                SIP from address Host Part: vp.thinktel.ca
            SIP tag: as76a0018a
        To: <sip:6478691125@159.18.161.67>
            SIP to address: sip:6478691125@159.18.161.67
                SIP to address User Part: 6478691125
                SIP to address Host Part: 159.18.161.67
        Contact: <sip:6473172818@96.71.145.239>
            Contact Binding: <sip:6473172818@96.71.145.239>
                URI: <sip:6473172818@96.71.145.239>
                    SIP contact address: sip:6473172818@96.71.145.239
        Call-ID: 0230a1f07327c4323b4e96dc630a6f3f@vp.thinktel.ca
        CSeq: 102 INVITE
            Sequence Number: 102
            Method: INVITE
        User-Agent: Asterisk PBX
        Max-Forwards: 70
        Date: Sat, 30 Oct 2010 18:53:42 GMT
        Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO
        Supported: replaces
        Content-Type: application/sdp
        Content-Length: 215
    Message Body
        Session Description Protocol
            Session Description Protocol Version (v): 0
            Owner/Creator, Session Id (o): root 5212 5212 IN IP4 96.71.145.239
                Owner Username: root
                Session ID: 5212
                Session Version: 5212
                Owner Network Type: IN
                Owner Address Type: IP4
                Owner Address: 96.71.145.239
            Session Name (s): session
            Connection Information (c): IN IP4 96.71.145.239
                Connection Network Type: IN
                Connection Address Type: IP4
                Connection Address: 96.71.145.239
            Time Description, active time (t): 0 0
                Session Start Time: 0
                Session Stop Time: 0
            Media Description, name and address (m): audio 16720 RTP/AVP 0 101
                Media Type: audio
                Media Port: 16720
                Media Protocol: RTP/AVP
                Media Format: ITU-T G.711 PCMU
                Media Format: DynamicRTP-Type-101
            Media Attribute (a): rtpmap:0 PCMU/8000
                Media Attribute Fieldname: rtpmap
                Media Format: 0
                MIME Type: PCMU
                Sample Rate: 8000
            Media Attribute (a): rtpmap:101 telephone-event/8000
                Media Attribute Fieldname: rtpmap
                Media Format: 101
                MIME Type: telephone-event
                Sample Rate: 8000
            Media Attribute (a): fmtp:101 0-16
                Media Attribute Fieldname: fmtp
                Media Format: 101 [telephone-event]
                Media format specific parameters: 0-16
            Media Attribute (a): ptime:20
                Media Attribute Fieldname: ptime
                Media Attribute Value: 20
            Media Attribute (a): sendrecv

note: My own IP and telephone numbers have been changed for privacy reasons.
edit: I’m using asteriskNow 1.7.1-2: Asterisk 1.4.36-1 and freepbx 2.7.0-7 CentOS 5.5

Your help is appreciated.

Thanks
Felix