VOIP PSTN inbound and outbound

Can someone give me some sample code for extensions.conf that would allow inbound/outbound PSTN (by pressing 9) and inbound/outbound VOIP (by pressing 0 or some other digit).

Thanks!!!

Hi,

Here is some a small sample; need some for infor from you.

  1. Do you have a VOIP povider setup and working?
  2. How are you conecting to the PSTN (hardware)?

[outgoing]
;VOIP-Out
exten => _9.,1,Dial(SIP/engin-out/${EXTEN:1})
exten => _9.,2,Hangup()

;PSTN-Out
exten => _0.,1,Dial(Zap/1/${EXTEN:1})
exten => _0.,2,Hangup()

Here’s what I have:

sip.conf=======================

[general]
context=default
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=yes

register =>spa400@192.168.1.151
register =>spa921:mytest@192.168.1.142
register =>6000@192.168.1.140/6000
register =>5435377:fuente1@sip.varphonex.com/5435377

[spa400]
type=peer
user=sip400
;secret=Admin
host=192.168.1.151
dtmfmode=rfc2833
canreinvite=no
nat=yes
context=from-pstn
disallow=all
allow=ulaw
allow=alaw
allow=g729
insecure=very

[spa921]
username=spa921
secret=mytest
type=friend
host=dynamic
context=to-varphonex ;used to be “to-pstn”

[6000]
type=friend
context=default
host=dynamic

[varphonex]
type=peer
host=sip.varphonex.com
fromuser=5435377
fromdomain=sip.varphonex.com
username=5435377
secret=fuente1
context=to-varphonex
canreinvite=no

[sip.varphonex.com]
username=5435377
user=5435377
type=friend
insecure=very
host=sip.varphonex.com
fromdomain=sip.varphonex.com
context=from-pstn

extensions.conf=====================
[[general]
static = yes
writeprotect = yes
clearglobalvars = yes

[global]
;DIALOUT = 9

[default]

[from-pstn]
exten => spa400,1,Dial(SIP/spa921)
exten => spa400,n,Hangup()

[to-pstn]
exten => _9xxxxxxxx,1,Dial(SIP/${EXTEN:1}@spa400,20)
exten => _9xxxxxxxx.,n,Hangup()

[to-varphonex]
exten => _0xxxxxxxxxx,1,Dial(SIP/${EXTEN:1}@varphonex)
exten => _0.,n,Hangup()

[from-varphonex]
exten => varphonex,1,Dial(SIP/spa921)

=================================

Here’s the result of an outbound call starting with “0” to dial-out:

== Using SIP RTP CoS mark 5
– Executing [07734904492@to-varphonex:1] Dial(“SIP/spa921-c0008a60”, “SIP/7734904492@varphonex”) in new stack
== Using SIP RTP CoS mark 5
– Called 7734904492@varphonex
– SIP/varphonex-02514450 is making progress passing it to SIP/spa921-c0008a60
– SIP/varphonex-02514450 is making progress passing it to SIP/spa921-c0008a60
– SIP/varphonex-02514450 is making progress passing it to SIP/spa921-c0008a60
– SIP/varphonex-02514450 answered SIP/spa921-c0008a60
– Packet2Packet bridging SIP/spa921-c0008a60 and SIP/varphonex-02514450
== Spawn extension (to-varphonex, 07734904492, 1) exited non-zero on ‘SIP/spa921-c0008a60’

======================================

It looks like I’m getting there and then something pukes at the tend… get the busy tone.

Other problems:

PSTN in and out. can’t hear any sound. Just rings and answers and nothing else. Using ulaw codec.

I have one test phone for a demo. How do I get it to reference two different “contexts” 9 for PSTN and 0 for VOIP without recoding the section [spa921]???

Thanks again for your help!!!

Why would SIP/varphonex pass the call to SIP/SPA921 which is my phone. Shouldn’t it be the other way around? Perhaps something is buggy in the code?

It’s passing the “call is making progress” indication, not the call.

Nothing is wrong in that respect.

After a lot of troubleshooting… I got frustrated and just shut down my firewall. Low and behold… that did it. Calls go through perfect VOIP and PSTN. Now, I just need to figure out which ports it is trying to use.