Labs/Ubiquity/dial
Back to Labs/Ubiquity/Commands_In_The_Wild.
Asterisk related functionality will go here Labs/Ubiquity/Asterisk
LEGAL NOTICE: Mozilla is providing links to these third-party Ubiquity commands as a courtesy, and makes no representations regarding the commands or any information related there to. Any questions, complaints or claims regarding the commands must be directed to the appropriate developer or software vendor.
Dial Command
Using Asterisk PBX & Ubiquity, one can create the 'dial' command to send out a call to a configured SIP phone and once answered the number entered will be dialed.
Contents
Asterisk Setup
Most of the documentation for this will be on other sites. I'll give just a general overview. There are also several ways this could be accomplished and this is just one method. Also be aware that some of these configurations could leave your asterisk machine open to attacks if not setup properly so read the manual.
http.conf & manager.conf
AJAM - Setup the Asterisk HTTP server and allow AMI to operate on HTTP.
I set the bind address to my public IP and bind port as 8088 in this example.
The prefix was also set to ubiquity instead of asterisk.
sip.conf
There should be some type of account setup for outbound termination of sip calls.
Should also have a friend setup with an extension. This will be used for your SIP phones authentication.
In this example I use a sip extension/user of 201.
extensions.conf
PROVIDER_FROM_SIP_CONF - should be updated to match your provider defined in sip.conf.
exten => _X.,1,Dial(SIP/PROVIDER_FROM_SIP_CONF/${EXTEN}) exten => _X.,n,Hangup()
Once this is setup reload or restart asterisk.
Ubiquity
This seems to achieve what we're looking for. Any updates or modifications to this please add back on this page or perhaps there is some other way of managing this?
Add the following in your Ubiquity Command Editor.
CmdUtils.CreateCommand({ name: "dial", takes: { "number":noun_arb_text }, icon: "http://foovax.com/favicon.ico", author: {name: "Justin", email: "justin@foovax.com"}, description: "Dials a call with Asterisk", help: "Dial NXXNXXXXXX - Rings configured SIP extension and dials number on answer", execute: function( directObject ) { var number = directObject.text; var url = "https://123.123.123.123:8088/ubiquity/manager?"; var auth = { action: "login", username: "ubiquity", secret: "ubiquitydemo" }; var dial = { action: "originate", channel: "SIP/201", context: "custom-ubiquity", exten: number, priority: "1" }; jQuery.get( url, auth, function( ) { jQuery.get( url, dial); }); } })
- Will need to update the IP address (123.123.123.123) to the IP of *PBX.
- Modify the username and secret to match whatever was setup in manager.conf.
- Update channel to match the user or extension of your SIP phone. (IAX, Zap, or Local)
The command will send auth varaibles to the PBX. When a successful return is received the dial (originate) variables will then be passed which causes the call to begin.
Usage
dial 1231231234
- Extension 201 will start ringing as soon as enter is pressed.
- Answer Extension 201 (x-lite auto answer button is handy)
- 1231231234 starts to dial.
- Talking with called party
TODO
- Handle returns or errors
- Create package ast-[command] (ast-dial, ast-hold, ast-chans, ast-trans)
- SIP phone embedded into Ubiquity preview?
Contact
- Sarge_ - Discuss in the ubiquitously forum.