Utilisant Asterisk comme une passerelle du fournisseur

j'ai 2 sip Serveurs dans différents réseaux locaux. Freeswitch et un de plus - Asterisk.

Asterisk Les usages VPN avec un fournisseur qui a fourni DID. Tous les utilisateurs sont enregistrés sur Freeswitch. Comment puis-je rediriger les appels vers le fournisseur via Asterisk et retour,

J'ai essayé sofia / default / DIDNUMBER @ ASTERISKSERVERIP: 5060, Mais l'appel ne passe pas au fournisseur.
Invité:

Blanche

Confirmation de:

Asterisk ⟷ FreeSWITCH

Bien sûr, vos besoins peuvent être différents, mais c'est un bon départ. - J'ai une paire de serveurs avec une connexion privée, vous devrez peut-être adapter des mesures d'authentification, mais cela devrait illustrer les bases de l'interaction en arrière et en avant, la transition vers le bon contexte, etc. .

Star

pjsip.conf

[tel]
type=transport
protocol=udp
bind=10.8.0.2 # set asterisk's IP -- bind to this address

[acl]
type=acl
deny=0.0.0.0/0
permit=10.8.0.3/32 # allow only calls from freeswitch who is on 10.8.0.3 see above deny

[fs]
type=identify
endpoint=fs
match=10.8.0.3 # identify/auth traffic from freeswitch by its IP

[fs]
type=endpoint # set options for endpoint we identified just above
trust_id_inbound=yes
trust_id_outbound=yes
aors=fs
context=from-internal ## WHERE DO CALLS FROM FREESWITCH TO ASTERISK GO?
allow=!all,g722,ulaw
transport=tel

[fs]
type=aor
contact=sip:10.8.0.3 # address-of-record to find freeswitch so can dial to fs without it registering with us (this is fed up to [fs] type=endpoint via its aors above so calls to Dial(PJSIP/1234@fs) dials 1234 on FreeSWITCH 10.8.0.3)

extension.conf

[from-internal]
include = toFreeSWITCH

[toFreeSWITCH]
exten = _N11!,1,Dial(PJSIP/${EXTEN}@fs)
exten = _0!,1,Dial(PJSIP/${EXTEN}@fs)
exten = _3XX,1,Dial(PJSIP/${EXTEN}@fs)
exten = _1NXXNXXXXXX,1,Dial(PJSIP/${EXTEN}@fs)
exten = _508NXXXXXX,1,Dial(PJSIP/${EXTEN}@fs)
exten = _774NXXXXXX,1,Dial(PJSIP/${EXTEN}@fs)

FreeSWITCH

conf / autoload_configs / acl.conf.xml

Ajoutez-le à l'intérieur

<network-lists>

:

<list default="deny" name="asterisk">
<node cidr="10.8.0.2/32" type="allow"></node>
</list>

conf / sip_profiles / asterisk.xml

<profile name="asterisk">
<gateways>
<gateway name="asterisk">
<param name="username" value="freeswitch"/>
<param name="realm" value="your-asterisk-domain"/>
<param name="password" value="unused-but-required-field"/>
<param name="from-domain" value="your-asterisk-domain"/>
<param name="proxy" value="10.8.0.2"/><!-- ASTERISK ADDRESS -->
<param name="register" value="false"/><!-- INSTEAD WE SET AOR IN PJSIP.CONF -->
<param name="cid-type" value="pid"/>
<param name="rfc-5626" value="true"/>
</gateway>
</gateways>
<settings>
<param name="apply-inbound-acl" value="asterisk"/>
<param name="auth-calls" value="false"/>
<param name="context" value="public"/><!-- WHERE DO CALLS FROM ASTERISK COME INTO? -->
<param name="rtp-ip" value="10.8.0.3"/><!-- this FreeSWITCH MEDIA IP -->
<param name="sip-ip" value="10.8.0.3"/><!-- this FreeSWITCH SIP IP -->
</settings>
</profile>

dialplan.xml

Adapter et ajouter à DIALPLAN

:

<extension name="to-asterisk">
<condition expression="^([2-9]11|1?[2-9]\d{2}[2-9]\d{6}|3\d{2})$" field="destination_number">
<action application="set" data="dialed_extension=$1"></action>
<action application="export" data="dialed_extension=$1"></action>
<action application="set" data="call_timeout=30"></action>
<action application="set" data="hangup_after_bridge=true"></action>
<action application="set" data="continue_on_fail=true"></action>
<action application="export" data="rtp_secure_media=false"></action>
<action application="bridge" data="sofia/gateway/asterisk/${destination_number}"></action>
</condition>
</extension>

</network-lists>

Pour répondre aux questions, connectez-vous ou registre