TUTORIAL GoIP: Random Prepend

danny7139

New Member
Joined
Jul 18, 2014
Messages
4
Reaction score
3
Hello,

I'm new to freepbx and asterisk in general. I currently have several GOIP gateways, ranging from 16-32 sims in each, connected to my pbx. With the GOIP configured in config by line I can complete calls with success. The issue I am facing is that it's required that I dial a gateway prefix before the telephone number. Obviously this will be a burden to my clients. However I need to be able to dial individual sims on the GOIP so my question is, can I somehow have a script that randomizes a prepend ranging from 01-32 before sending it to the GOIP trunks. Due to the fact that I have 16 and 32 units this will need to be customized per trunk. I've looked at the RAND function but my coding skills aren't too great.

Thank you in advanced for any light you may shed.
 

danny7139

New Member
Joined
Jul 18, 2014
Messages
4
Reaction score
3
Here is what I placed in my extensions_custom.conf.

Code:
[outbound]
exten => _X.,1,Noop
  same => n,Gosub(pickSimnum,cell${RAND(1,5)},1)
  same => n,Dial(SIP/layal20/${EXTEN})
 
[pickSimnum]
exten => sim1,1,Set(VARIABLE=1NXXNXXXXXX)
  same => n,Return
exten => sim2,1,Set(VARIABLE=2NXXNXXXXXX)
  same => n,Return
exten => sim3,1,Set(VARIABLE=3NXXNXXXXXX)
  same => n,Return
exten => sim4,1,Set(VARIABLE=4NXXNXXXXXX)
  same => n,Return
exten => sim5,1,Set(VARIABLE=5NXXNXXXXXX)
  same => n,Return

I then created a custom trunk with this dial string:
Local/$OUTNUM$@outbound

However it's not working. Any suggestions? Thanks
 

atsak

Guru
Joined
Sep 7, 2009
Messages
2,381
Reaction score
436
What kind of GOIP gateways do you use? Thinking that might be handy for some others to know something that works . . .
 

danny7139

New Member
Joined
Jul 18, 2014
Messages
4
Reaction score
3
What kind of GOIP gateways do you use? Thinking that might be handy for some others to know something that works . . .


I use the following with T-Mobile mvno sims:
Hybertone goip-32
Hybertone goip-16

This is the context in my trunk PEER details:
Code:
context=from-pstn
host=dynamic
type=peer
qualify=yes
username=layal16
secret=*****
disallow=all
allow=g729&ulaw&alaw

The GOIP settings:
Goip_settings.jpg

Each line has a different gateway prefix so I can dial individual sims. Which the prefix is removed in the call out dial plan before dialing out:
Goip_settings_2.jpg
 

Members online

No members online now.

Forum statistics

Threads
25,782
Messages
167,509
Members
19,202
Latest member
pbxnewguy
Get 3CX - Absolutely Free!

Link up your team and customers Phone System Live Chat Video Conferencing

Hosted or Self-managed. Up to 10 users free forever. No credit card. Try risk free.

3CX
A 3CX Account with that email already exists. You will be redirected to the Customer Portal to sign in or reset your password if you've forgotten it.
Top