Asterisk and A2billing - asterisk

I am trying to configure asterisk to work with a2billing.
I need a prepaid billing system for the extensions provisioned
on my system, so I will only be billing extension to extension calls for now.
I cannot seem to find any comprehensive tutorial that does this(i.e without outside connectivity billing).
Any help would be appreciated.

You need setup context like this in /etc/asterisk/extensions.conf:
[a2billing]
exten => _X.,1,AGI(a2billing.php,1)
After that in agi-conf1 you need set use-dnid=yes, number-try=1, play-audio=no
And assign to your extension accountcode=username(pin) in a2billing and context=a2billing
After that you can call ext2ext using 5555 prefix(default).
Or you can use context
[exts]
exten => _X.,1,Set(CDR(DNID)=5555${EXTEN})
exten => _X.,2,Goto(a2billing,5555${EXTEN},1)

Related

Deleting FreePBX Speed Dials

Using freePBX 15.
From a phone, I entered *75 ( Asterisk Speed Dial entry "star code" )
and a speed dial label and code. This was just for a test.
Now, I want to delete it, but haven't found any way to do this.
I checked the Asterisk Phonebook for my entry, but it wasn't there.
To delete speeddial you should manually remove asterisk database entry key AMPUSER/${AMPUSER}/speeddials/${entry}
Here is part of code which set it.
exten => s,n(success),Set(DB(AMPUSER/${AMPUSER}/speeddials/${newlocation})=${newnum})
No, you have no option for do that via dialplan, but you always welcome to make changed module.
For more info about database see this
https://wiki.asterisk.org/wiki/display/AST/Asterisk+Internal+Database

Adding a prefix in outgoing calls in Asterisk

We have a many services in our company, each one must display a different number in his outgoing calls. We use a Asterisk SIP server.
Our SIP provider asks us to make our Asterisk server send a prefix before the outgoing number.
for exemple, for a normal call from the extension 1200, the SIP server send the number 0033123456789.
we want to make it adding a prefix for calls from each extension, for exemple :
add the prefix 400 before calls from the extension 1200 to send 40033123456789.
add the prefix 401 before calls from the extension 1201 to send 40133123456789.
... etc.
Can you help please ?
Many thanks.
Regards.
There might be several ways to achieve what you need, if calls from all extensions hit same context(context start with [some-context-name]), then you might achieve it in following way:
[some-context-name]
exten => _00X.,1,ExecIf($["${CALLERID(num)}" = "1200"]?Dial(SIP/mytrunk/400${EXTEN:2}))
exten => _00X.,1,ExecIf($["${CALLERID(num)}" = "1201"]?Dial(SIP/mytrunk/401${EXTEN:2}))
Additionally you might have separate context per extension or you might implement all of this inside AGI script.

Setting a Dialplan for guests?

I am trying to configure my asterisk to regsiter every user who tries to connect to it, and allow it to establish calls. I have read that I should set "allowguest = yes" in sip.conf.
What about the dialplan in extensions.conf ? What should I add so that all my users could make and recieve calls ? (this is my first questions).
I would go even more precise about the users : is it possible to allow only guests from one precise domain ? If yes please help find how to do it, I will be very thankful.
Guest calls will go to default context which is in general section of sip.conf
[general]
context=some_restricted_access
About dialplan for calls - you need read some book for beginner or install freepbx/other web which do dialplan for you.
No, you can't allow guests from domain. But you can try play with realm= setting or allow access from one ip by using ip-authentification.

Delete dial rule in Asterisk via AMI

I'm running Asterisk 11.4.0, and I've got access to it via AMI.
I've got a line like this in my [default] context in extensions.conf.
exten => 12345,1,Dial(SIP/${EXTEN}#0041905093,30,r)
So, i have mask (12345) and I need to delete a dial rule, belonging to the mask.
How can I do this?
I managed to do this:
If you want to remove extension A from context B, you need write CLI command (using "action" = "command") like this:
dialplan remove extension A#B

Perform a web look up from Asterisk dial plan?

I have a text file that I would like to access and use in a dial plan. What is the syntax for accessing the file from within the dial plan?
Something like:
Dial(tech/service/[http://textfile])
Since it seems you have already made the file accessible from a web server you can use the asterisk curl function :
You'll probably need to recompile asterisk after installing the curl dev libraries,
http://www.voip-info.org/wiki/index.php?page=Asterisk+func+curl
Then you can :
exten => s,1,Set(dest=${CURL(http://textfile)})
exten => s,2,Dial(SIP/${dest})
You can try to create an AGI script (in PHP, C, Java whatever language) and call that from the dialplan:
exten => _x,n,AGI(your-script.php)
You can then do all sorts of stuff in that script. If you can provide more details of what you're trying to do, guys on StackOverflow can probably guide you better.

Resources