T
T
Timur2015-07-16 00:52:37
Telephony
Timur, 2015-07-16 00:52:37

How to bind sip user freeswitch to a specific trunk?

Good day. I'm at a dead end, help me figure out where to dig.
There is an installed freeswitch to which certain users connect via sip (standard id 1000, 1001 ... ). And there are several configured trunks (sipnet.ru, multifon.ru). Each user must call the outside world (mobile and landline phones) through a specific trunk. For example, user 1000 via sipnet.ru, user 1001 via multifon.ru. Incoming calls are not required.
How to do it?
Now in vars.xml I registered in default_provider="sipnet.ru". Created in direcory/default/sipnet.ru.xml. I made a test of an outgoing call from a standard user with id 1000 - everything works well. But I don’t understand how to bind a trunk to a user.
Please describe in words a brief scheme for further work. I understand that I need to dig somewhere in the direction of the dialplan, but I don’t understand where.
PS with telephony and freeswitch sign a week

Answer the question

In order to leave comments, you need to log in

2 answer(s)
V
Vladimir, 2015-07-16
@XAKEPEHOK

in user profile 1000

<variables>
...
    <variable name="provider" value="sipnet"/>
...
</variables>

at 1001
<variables>
...
    <variable name="provider" value="multifon"/>
...
</variables>

create gateways for each operator with the appropriate names sipnet and multifon
in the dialplan
<extension name="OUT" continue="true">
    <condition field="destination_number" expression="^\d{9,15}$">
        <action application="bridge" data="sofia/gateway/${provider}/${destination_number}"/>
    </condition>
</extension>

V
Viktor, 2015-08-15
@awsswa59

according to the documentation, there is no need to invent a separate field, there is a special ${toll_allow}
This is how the extension checks for the presence of the ${toll_allow} field and the content of the word locacl in it,
and if the condition matches, the call will go further

<include>
  <extension name="local.samsung">
    <condition field="${toll_allow}" expression="local"/>
    <condition field="destination_number" expression="^(2\d{3})$">
      <action application="set" data="effective_caller_id_number=${outbound_caller_id_number}"/>
      <action application="set" data="effective_caller_id_name=${outbound_caller_id_name}"/>
      <action application="bridge" data="sofia/gateway/samsung/$1"/>
    </condition>
  </extension>
</include>

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question