Search code examples
freeswitch

Freeswitch converts 407 proxy authentication to 480 Temporary unavailable


Network set up like below.

End User ------- Kamailio -------- Freeswitch ----- Sip Server A

  1. Registration in SIP Server A is success, as the request directly pass through kamailio to SIP server A, leaving freeswitch.
  2. On receiving INVITE request from end user to Kamailio and then freeswitch and reach to SIP server A, it responds 407 proxy authentication to validate the user but in reply freeswitch sends ACK
  3. But freeswitch replies back to kamailio as 480 temporary unavailable and call is getting dropped.

    End User ------ Kamailio ----------- Freeswitch -------- SIP Server A

    REGISTER -------> | ---------------------------------------------->|

    | -----------> | <----------------------- 200 OK
    

    INVITE -------------> | --------------------->| --------------------> |

                                |<----------- 407  
                                       (Proxy Auth Req.)   
                               ACK ---------> |
    
      | <--------- | <-------- 480 
                          (Temporary Unavailable) 
    

So here is my question ,

  1. Reason for changing the response code in freeswitch from 407 to 480?
  2. And how can configure freeswitch, so that it will pass the 407 response directly to kamailio , instead it convert to 480.

Need suggestions...


Solution

  • FreeSWITCH is not a SIP-proxy, FreeSWITCH is B2BUA. It means that FreeSWITCH trying to make independent call to SIP Server A. If it will be successful, then FreeSWITCH will bridge it with call from End User (not from kamailio, because kamailio is a SIP-proxy in this scheme, not B2BUA). It can't resend 407 to kamailio because it haven`t appropriate mechanism. But you can store authentication information in gateways on a FreeSWITCH side and instruct FreeSWITCH to make appropriate calls for each user throw dialplan.

    It will work, if you write somthing like this in your external.xml SIP-profile config:

    <gateway name="asterlink.com">
     <param name="username" value="cluecon"/>
     <param name="password" value="2007"/>
     <!--/// do not register ///-->
     <param name="register" value="false"/>
    </gateway>
    

    and something like this in dialplan default.xml:

    <extension name="end-user">
     <condition field="${sip_from_user}" expression="<end_user_caller_id_number>">
      <action application="bridge" data="sofia/gateway/asterlink.com/${destination_number}"/>
     </condition>
    </extension>