PJSIP Not Performing Outbound Authentication

Home » Asterisk Users » PJSIP Not Performing Outbound Authentication
Asterisk Users 5 Comments

I am using Asterisk 20.3.0 with PJSIP. I have setup a trunk to my ISP
(Twilio) who requires outbound authentication. My pjsip.auth.conf contains:

[Twilio]
type=auth auth_type=userpass password=mysecret username=myun

However, my calls using the trunk are rejected with a 403. Using pjsip logging I notice that the outgoing invite does not have an authentication line. Why is Asterisk not sending credentials to the ISP? SIP transactions are:
> INVITE
< 100 TRYING < 403 FORBIDDEN Or is this normal? Must Twilio respond with a 407 which will cause Asterisk to authenticate? --

5 thoughts on - PJSIP Not Performing Outbound Authentication

  •     Dis you set “outbound_auth” in your endpoint configuration to Twilio?


    Telecomunicaciones Abiertas de México S.A. de C.V. Carlos Chávez
    +52 (55)8116-9161

  • Twilio has a nice technical document to setup a trunk with PJSIP. It includes an example for a pjsip_wizard.conf https://assets.cdn.prod.twilio.com/documents/TwilioElasticSIPTrunking-AsteriskPBX-Configuration-Guide-Version2-1-FINAL-09012018.pdf

    Maybe that helps.

    And make sure for your outgoing calls to set the callerid to a valid caller Id which ist authorized with your twilio account. It will not allow outgoing calls if the number is not recognized by twilio

    -H


    Henning Follmann | hfollmann@itcfollmann.com

  • Yes, I set Outbound_auth=Twilio

    In the [Twilio] section of pjsip.endpoint.conf

    But does that mean the initial invite should contain an authentication line, or only that it will expect a 407?

    —–Original Message—–
    From: asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] —
    Telecomunicaciones Abiertas de México S.A. de C.V. Carlos Chávez
    +52 (55)8116-9161

  • I didn’t use pjsip_wizard, I’m kind of crafting this by hand as I learn. I actually have a plain asterisk, and a FreePBX, system to help me learn. I sometimes create something in FreePBX to see what it does to the config files. So that’s how I modelled my pjsip.X.conf files

    If I issue the command “pjsip show endpoint Twilio” it does show that outbound_auth=Twilio

    Does that mean the initial invite will contain authentication info? Or does Asterisk still wait for a 407?? (I’m wondering if maybe Asterisk is working normally, this is a Twilio config problem). And I confirmed the CID info matches an account on Twilio, so it’s not that.

    —–Original Message—–
    From: asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] Twilio has a nice technical document to setup a trunk with PJSIP. It includes an example for a pjsip_wizard.conf https://assets.cdn.prod.twilio.com/documents/TwilioElasticSIPTrunking-AsteriskPBX-Configuration-Guide-Version2-1-FINAL-09012018.pdf

    Maybe that helps.

    And make sure for your outgoing calls to set the callerid to a valid caller Id which ist authorized with your twilio account. It will not allow outgoing calls if the number is not recognized by twilio

    -H


    Henning Follmann | hfollmann@itcfollmann.com

  • In case it helps, here’s the invite my Asterisk system sends to the ITSP (obfuscated a bit). This should be triggering a 407 from the ITSP but it’s not. So I must be missing something in this message…can’t see what

    <--- Transmitting SIP request (930 bytes) to UDP:54.172.60.0:5060 --->
    INVITE sip:12223334444@54.172.60.0:5060 SIP/2.0
    Via: SIP/2.0/UDP 122.59.105.83:5060;rport;branch=z9hG4bKPj1b1875dc-11b7-4882-bbe3-d56c6041043a From: “MYNAME” ;tag=d147259b-dc0a-454e-8c6c-14ac59e85197
    To:
    Contact:
    Call-ID: db46e226-73de-46f9-8b96-388eb5f0dd5e CSeq: 13035 INVITE
    Allow: OPTIONS, REGISTER, SUBSCRIBE, NOTIFY, PUBLISH, INVITE, ACK, BYE, CANCEL, UPDATE, PRACK, MESSAGE, REFER
    Supported: 100rel, timer, replaces, norefersub, histinfo Session-Expires: 1800
    Min-SE: 90
    Max-Forwards: 70
    User-Agent: MyUA
    Content-Type: application/sdp Content-Length: 235

    v=0
    o=- 954636103 954636103 IN IP4 122.59.105.83
    s=Asterisk c=IN IP4 122.59.105.83
    t=0 0
    m=audio 15860 RTP/AVP 0 101
    a=rtpmap:0 PCMU/8000
    a=rtpmap:101 telephone-event/8000
    a=fmtp:101 0-16
    a=ptime:20
    a=maxptime:150
    a=sendrecv

    —–Original Message—–
    From: asterisk-users [mailto:asterisk-users-bounces@lists.digium.com] Twilio has a nice technical document to setup a trunk with PJSIP. It includes an example for a pjsip_wizard.conf https://assets.cdn.prod.twilio.com/documents/TwilioElasticSIPTrunking-AsteriskPBX-Configuration-Guide-Version2-1-FINAL-09012018.pdf

    Maybe that helps.

    And make sure for your outgoing calls to set the callerid to a valid caller Id which ist authorized with your twilio account. It will not allow outgoing calls if the number is not recognized by twilio

    -H


    Henning Follmann | hfollmann@itcfollmann.com