News:

On Tuesday September 6th the forum will be down for maintenance from 9:30 PM to 11:59 PM PDT

Main Menu

Call script from Obi110

Started by falloutphil, December 08, 2013, 07:35:59 AM

Previous topic - Next topic

falloutphil

Hi all,

I've had my Obi110 for 2 weeks and my config is gradually getting more and more complex!

I'm pretty happy with it now, it's a sweet box - but I had yet another idea today.

I want to be able to call a script (either remotely via REST or whatever, or installed on the Obi110 itself) that will be triggered on a certain sequence of digits - the script will then interrogate a database and perhaps replace the number with a cheaper alternative.

I doesn't look like this is possible from Obi110 - but wanted to check if anyone had any success in anything like this?

Can the Obi make remote script calls OR can I install scripts on the Obi (shell, Perl, Python, just about anything would do as it's a simple script)?

The best I can come up with is call a SIP trunk with the dialled number as a trunk variable and then offload processing to my SIP server - I don't even know if this is possible, and I really need to process the number *before* I decide which SIP service or POTS to call with.  So this is messy from the outset.

I suspect I'll need to setup something like Asterix on my local computer to handle something this complex.... but interested to hear people's thoughts!

---------
One last question - I'm assuming Obi110 has no way of routing by time (peak/off-peak) - this would be very useful in the UK where most POTS calls are free after 7pm, but expensive at other times?



Thanks,

Phil.

sdb-

Yes, it is sounding like you are about ready for a more fully featured PBX than what the little OBi can do. :)

I've played with Asterisk, but FreeSwitch looks better to me.  Either can run on a little raspberry pi or even on some routers if you are using ddwrt or openwrt.  Or pbexs.com has a free pbx plan to avoid running either yourself.

A user here named giqcass has been doing experimentation to have the OBi call a remote script for things like dyndns updates and to trigger a gvoice callback.  All remote.  Don't think there is any way to have the script on the OBi.

falloutphil

Thanks for the reply!  I suspected as much.

I have got this working after a bit of fiddling using the method I suggested by getting the Obi110 to dial with trunk variables and offload the processing to my SIP provider.

I can then use an Anveo IVR to parse these and make the remote http calls to translate the number.

It's not perfect, but it works and saves a few pence (it was more about the challenge to be honest).

I did have to write a cgi script to sit between the REST translation service and Anveo to reformat the numbers as Anveo is limited in what it can do with the returned data.

Still if anyone wants to know how to do on-the-fly translation of 0845/0870/etc numbers to fixed line numbers in the UK, I can explain in detail!


QBZappy

@falloutphil

Quote from: falloutphil on December 08, 2013, 01:41:44 PM
Still if anyone wants to know how to do on-the-fly translation of 0845/0870/etc numbers to fixed line numbers in the UK, I can explain in detail!

Rule number 1 in life. Never let an opportunity to learn something new pass you by. falloutphil I've pulled up a chair and eagerly waiting to hear details of what seems a most interesting project.
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

drgeoff

1.  The OBis are quite capable of converting an input number to a completely different number by means of the dial plans.  However the length limit on the dial plan fields means that the method won't work for more than a handful of numbers to be converted.

2.  The OBis have no way (as I write this) of making any of their settings dependent on time of day.  It certainly would be nice to have that for the reason falloutphil mentions.

QBZappy

Quote from: falloutphil on December 08, 2013, 07:35:59 AM
One last question - I'm assuming Obi110 has no way of routing by time (peak/off-peak) - this would be very useful in the UK where most POTS calls are free after 7pm, but expensive at other times?

I think this could be accomplished indirectly. The OBi can be setup to use trunks. Then consider that routers can block internet access by time of day. Well at least a tomato firmware router can, and I suspect others can as well. Combine the two and you might end up with what you need.

This is what you need to work out. After a good long look at my Tomato Access Restriction settings, it might be possible to block a port/application/source or destination ip (whatever) in a granular way.

BTW can you accomplish this using a softphone. I believe Linphone can be controlled programmatically.
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

giqcass

I had been asking Obi to implement a way to call a remote script based on a speed dial.  I was also hoping we could pass variables in the url.  I have an untested idea about running my own XMPP gateway and tricking my Obi into talking to it instead of Googles XMPP server.  When Google shuts down XMPP support I expect app engine to still support it.  That would give me a lot of ability to add features to my Obi.  If Obi would implement my feature request it would be a lot simpler and more flexible.
Long live our new ObiLords!

QBZappy

#7
@gigcass

List of XMPP servers
http://xmpp.org/xmpp-software/servers/

Over on the Jitsi forums I read a lot of people are using OPENFIRE
http://www.igniterealtime.org/projects/openfire/index.jsp

ejabberd
http://www.process-one.net/en/ejabberd/

free hosted service jabber.org (free XMPP account)
http://www.jabber.org/

Note that gmail accounts are federated, meaning that any xmpp account can communicate with another xmpp account. This is similar to email. Any email service can send to any other email service. After Google drops xmpp support for GV, it is not clear that gmail will still speak xmpp. This implies that it is not clear if using the gmail xmpp client in the OBI device can speak to a private xmpp server. This could be tested by setting up an private xmpp server and setting up an account other than a gmail account to see if it connects.

List of xmpp clients:
http://xmpp.org/xmpp-software/clients/

Note that xmpp is a chatting protocol not really intended to be used for voip. GTALK (voip product) somehow used xmpp to to do voip (note as opposed to sip). I'm not sure how the OBi can be expected to do voip with a private xmpp server. This is only possible because Google did a mashup of GTALK/GCHAT/GV that we can make a phone call. The only other voip app that I know which uses xmpp is Jitsi. AFAIK the xmpp part is simply used for presence and IM. The actual voip part of the app is using sip.

What do you expect from connecting an OBi to a private xmpp server?

EDIT:
Apparently voice chat can be done on a private xmpp server. There is some potential in this line of reasoning, barring any technical issues about how all of this is implemented in the OBi itself. See here for an idea of how others have implemented this with means other than an OBi.
Voice Chat
http://community.igniterealtime.org/message/224079#224079
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

giqcass

Quote from: falloutphil on December 08, 2013, 07:35:59 AM
One last question - I'm assuming Obi110 has no way of routing by time (peak/off-peak) - this would be very useful in the UK where most POTS calls are free after 7pm, but expensive at other times?

I like the Idea QBZappy  had using trunk groups. The main issues I can think of.

  • Make sure register intervals are low so the Obi knows right away when the router cuts off a service.
  • What happens if a call is going on when the service is shut off.  My first thought was it would cut off.  After thinking for a bit I realized the call itself could be on a different port then the registration server.

Hairbrain Idea #1:

  • What if you created 2 xml files for auto provisioning?  One for night time and one for day time.  Set up your own server and make sure one file is available during the day with the correct dial plans and a different one is available at night. The Obi would grab the provisioning file and update automatically.  The Obi does a graceful reset after updates so if you are in the middle of a call it would reset until you hung up.

Hairbrain Idea #2:

  • I think it would only work out on a 200 series Obi using Obi plus service.  The call could be routed through the Auto Attendant.  This would be done using a hotline feature or by sending calls to a sip uri at localhost.  I don't use ObiPlus so I don't have experience with that part of the system.
Long live our new ObiLords!

giqcass

Quote from: QBZappy on December 08, 2013, 09:12:40 PM
What do you expect from connecting an OBi to a private xmpp server?

I know that the Obi sends information to the XMPP server about presence and about who it wants to call.  If I set up my own XMPP server I could intercept that information and make the server do various things for me.  Add pygooglevoice to the XMPP server and it has the ability to initiate a callback to an Ipkall number I have forwarded to my Obi.
Long live our new ObiLords!

QBZappy

Quote from: giqcass on December 08, 2013, 09:36:34 PM
Hairbrain Idea #1:

  • What if you created 2 xml files for auto provisioning?  One for night time and one for day time.  Set up your own server and make sure one file is available during the day with the correct dial plans and a different one is available at night. The Obi would grab the provisioning file and update automatically.  The Obi does a graceful reset after updates so if you are in the middle of a call it would reset until you hung up.

I think this would be trivial to setup, once you put the initial learning curve behind you. :) We could build off RonR's provisioning app. Can be setup using task scheduler, his apps are windows based. It could be used to push different configs at various times.

I found this interesting considering the topic.
Combining SIP and XMPP
http://www.onsip.com/about-voip/sip/combining-sip-and-xmpp
Owner of the 1st OBi110/100 units in service in Canada & South America. 1st OBi202 on my street. 1st OBi1032 in Montreal.

giqcass

#11
Quote from: QBZappy on December 08, 2013, 09:51:35 PM
We could build off RonR's provisioning app. Can be setup using task scheduler, his apps are windows based. It could be used to push different configs at various times.

I was thinking about using his script to make different preset xml files and then any server/language could be used to make sure the Obi has access to the appropriate file at the appropriate time.  Whatever system you use to host the provisioning files can do the file swapping.  A DDWRT or Tomato router could host the files on a usb drive and CRON could be set to move the files into a folder.  The Obi can be set up to look for the files in that folder.



Quote from: QBZappy on December 08, 2013, 09:51:35 PM
I found this interesting considering the topic.
Combining SIP and XMPP
http://www.onsip.com/about-voip/sip/combining-sip-and-xmpp

I read that article as well when I was researching my XMPP idea.

Long live our new ObiLords!

sdb-

Quote from: giqcass on December 08, 2013, 09:47:54 PM
Quote from: QBZappy on December 08, 2013, 09:12:40 PM
What do you expect from connecting an OBi to a private xmpp server?

I know that the Obi sends information to the XMPP server about presence and about who it wants to call.  If I set up my own XMPP server I could intercept that information and make the server do various things for me.  Add pygooglevoice to the XMPP server and it has the ability to initiate a callback to an Ipkall number I have forwarded to my Obi.

Sounds like straining at a gnat...

How about instead of XMPP, you run asterisk or freeswitch instead?  Having run a couple of different XMPP servers for several years, XMPP does pretty good at chat.  The jingle extension is a pain, and that is what you would need to interface with the OBi.  But the OBi will communicate with a SIP server for presence and in/outgoing calls so there is no need for XMPP.

There have been ways before to hook asterisk and freeswitch to googlevoice (such as pygooglevoice) and if it is possible in the future I'm sure there will be ways again.  That way you are standard VoIP as much as possible, and limit the impact of google voice changes to the "provider" layer of your server.

giqcass

#13
Quote from: sdb- on December 09, 2013, 08:31:58 PM
Sounds like straining at a gnat...

How about instead of XMPP, you run asterisk or freeswitch instead?  

Much of it is about learning.  I would like to see what else I can do with XMPP other then just chat and voice.  I would like to be able to interact with other systems.  Setting up my XMPP server won't cost me anything but time.  As far as I'm concerned XMPP is basically dead because even jabber.org seems to be stagnating but I already have a device that speaks it so why not play with it.  I want access to my appengine accounts via the phone.  I could also use, Voxeo, twillio, or tropo.  Voxeo is my favorite.   I plan on playing around with asterisk as well.  I have 4 ATAs sitting around here and I plan to get a Raspberry pi.  I haven't given freeswitch a lot of thought but I might check it out.  I mainly hang around this forum to see what everyone else is doing with their Obis so I appreciate your suggestions. Keep em coming!

If we could call a script like falloutphil said that would really rock!
Long live our new ObiLords!