freeswitch 连接外部 SIP Provider

1,  新增 SIP Provider,在 conf/sip_profiles/external 里面增加该配置文件

 

  <!-- sipprovider.xml -->

  <include>
  <gateway name="sipprovider">
    <param name="username" value="user"/>
    <param name="password" value="pass"/>
    <param name="realm" value="*"/>
    <param name="proxy" value="sipprovider_ip_addr"/>
    <param name="register" value="true"/>
        <param name="expire-seconds" value="600"/>
         <param name="ping" value="30" />
     <param name="sip-trace" value="true" />
  </gateway>
</include>

     这个 SIP Provider 要求 REGISTER,另外因为 freeswitch 是透过 NAT 访问,因此设置 30 秒发送 ping。

 

2, 将这个 SIP Provider 提供的 DID 映射到相应的 extension 上

    SIP Profile external.xml 设定了 context 默认为 public,因此我们需要编辑 conf/dialplan/public.xml

 

   <extension name="sipprovider">   <!-- your provider or any name you'd like to call it -->
    <condition field="destination_number" expression="xxxxxxx">  <!-- your DID for this gateway-->
       <action application="transfer" data="1001 XML default"/>
    </condition>
   </extension>

 

备注:

    也可以在 directory 里面配置这个 gateway,两种配置的区别可以看看这个连接

    http://wiki.freeswitch.org/wiki/Clarification:gateways

 

 

<anthm> if you put them in a user tag in your directory you can then tell


#


          sofia to manage the whole domain and it will iterate all the users


#


          in that domain and reg the gateways


#


<anthm> if you don't need that you can just put them in the sofia conf





What I gather from this is that if you only want certain extensions to be registered with your voip provider when a specific user registers with freeswitch you should define gateways in the directory section rather than in the sofia configuration. Conversely, if you always want an extension registered with a provider you would define the gateway as part of the sip profile.

 

3,  设定 extensions 可以通过这个  SIP Provider 拨打 PSTN 电话

     conf/dialplan/default.xml

 

   <extension name="Long Distance">
    <condition field="destination_number" expression="^00(/d+)$">
      <action application="set" data="effective_caller_id_number=xxxxxxxx"/>
      <!-- If your provider does not provide ringback (180 or 183) you may simulate
        ringback by uncommenting the following line. -->
      <!-- action application="ringback" /-->
      <action application="bridge" data="sofia/gateway/sipprovider/1550$1"/>
     </condition>
   </extension>

     注意:应该将新增的配置放置在下面信息以前    

    <!--
    WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING

    Anything you put below this line will usually get ignored due to the file in
    default/99999_enum.xml as it will transfer the call to the enum dialplan.

    WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
    -->

©️2020 CSDN 皮肤主题: 酷酷鲨 设计师:CSDN官方博客 返回首页