Provider Configuration: DID For Sale

From FreeSWITCH Wiki
Jump to: navigation, search

DID For Sale

Works and tested by creating one extension.

Installed FreeSWITCH on CentOS 5.2

cd /usr/local/freeswitch/conf/directory/default
[root@localhost default]# cat 19498858961.xml
<include>
  <user id="19498858961" mailbox="19498858961">
    <params>
      <param name="password" value="1234"/>
      <param name="vm-password" value="19498858961"/>
    </params>
    <variables>
      <variable name="accountcode" value="19498858961"/>
      <variable name="user_context" value="default"/>
      <variable name="effective_caller_id_name" value="Extension 19498858961"/>
      <variable name="effective_caller_id_number" value="19498858961"/>
    </variables>
  </user>
</include>
[root@localhost extensions]# pwd
/usr/local/freeswitch/conf/dialplan/extensions
[root@localhost extensions]# cat 19498858961.xml
<extension name="exten_19498858961">
      <condition field="destination_number" expression="^(19498858961)$">
        <action application="set" data="dialed_ext=$1"/>
        <action application="export" data="dialed_ext=$1"/>
      </condition>
      <condition field="destination_number" expression="^${caller_id_number}$">
        <!--<anti-action application="set" data="continue_on_fail=NORMAL_TEMPORARY_FAILURE,USER_BUSY,NO_ANSWER,TIMEOUT,NO_ROUTE_DESTINATION"/> -->
        <anti-action application="set" data="continue_on_fail=true"/>
        <anti-action application="bridge" data="user/${dialed_ext}@$${domain}"/>
        <anti-action application="answer"/>
      </condition>
    </extension>
[root@localhost extensions]#

Until here I was able to call this number from my local extensions 1001-1019 and vice versa. But Call did not come from PSTN number, I was getting SIP: 404 Error.

Then I added these lines in /usr/local/freeswitch/conf/dialplan/public.xml

 <extension name="public_did_didforsale">
      <condition field="destination_number" expression="^(19498858961)$">
        <action application="transfer" data="$1 XML default"/>
      </condition>
    </extension>

And it worked just fine.