Asterisk (VoIP) Plugin / Script Development
#1
Im running an Asterisk VoIP server at my home to play with and test possible things that i can make out of it. I managed to make incoming calls show a notification msg on my XBMC (TV) screen showing the incoming call's number, but i want to do more with my media center (such as what LinuxMCE offers) as to initiate calls from my screen using the remote (dont really know how useful this is, since in order to talk on the phone i will be using my voip phone) but just to explore possibilities. Anyways i came across this python script which allows to initiate a call to a given extension / number and direct it to a specific extension (i.e. the phone set next to me - again why wouldn't i just pick up the phone next to me and dial the number from it - really dont know but as i said, im just exploring possibilities).

Here is the script, without any xbmc integration or even being a plugin in its current form:
Code:
import socket

HOST="192.168.1.123"
PORT=5038

p = """Action: login
Events: off
Username: %(username)s
Secret: %(password)s

Action: originate
Channel: SIP/%(local_user)s
WaitTime: 60
CallerId: %(phone_to_dial)s
Exten: %(phone_to_dial)s
Context: outbound-local
Priority: 1

Action: Logoff
"""

def click_to_call(phone_to_dial, username, password, local_user):
    pattern = p % {
            'phone_to_dial': phone_to_dial,
            'username': username,
            'password': password,
            'local_user': local_user}

    s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
    s.connect((HOST, PORT))

    data = s.recv(1024)
    for l in pattern.split('\n'):
        print "Sending>", l
        s.send(l+'\r\n')
        if l == "":
            data = s.recv(1024)
            print data
    data = s.recv(1024)
    s.close()

if __name__ == '__main__':
    click_to_call(phone_to_dial='555-5555', username='user', password='pass', local_user='101')

my next step is add it as a programs plugin, in which i will enter the extension im i want to make my call from, and also enter (or select from a telephone directory) the number i want to dial.

Note: in order for this script to work, some modifications need to be done to asterisk's manager.conf as in to allow telneting into the server:
Code:
[general]
enabled = yes
;webenabled = yes
port = 5038

[user]
secret = pass
permit = 192.168.1.0/255.255.255.0
read = system,call,log,verbose,command,agent,user,dialplan,originate
write = system,call,log,verbose,command,agent,user,dialplan,originate

again, if anyone has any thoughts on how to make this useful, let me know, maybe we could make something out of this.
Reply
#2
How can I handle Inbound Calls?What are the things I need to handle Inbound calls using Asterisk 1.6 and xlite softphones??

please help me if you know about it.
Reply
#3
Information 
I get you.

I also have an asterisk pbx installed at home, integrated with Skype, PSTN and other DDIs. I see exactly what you mean and I support the question (better if I had the answer Laugh).
What is it used for on the LinuxMCE?
I want to start a project with Skype integration, but I'm stuck with the same question...

I'll monitor this thread.

--mr. kav
Reply
#4
albert_jr Wrote:How can I handle Inbound Calls?What are the things I need to handle Inbound calls using Asterisk 1.6 and xlite softphones??

please help me if you know about it.

how exactly do you want to handle inbound calls? what i have right now is that asterisk announces inbound calls on my tv(xbmc ui) through xbmc's http api commands (i posted the link for that here: http://forum.xbmc.org/showpost.php?p=466...stcount=19 )
Reply
#5
mr. kav Wrote:I get you.

I also have an asterisk pbx installed at home, integrated with Skype, PSTN and other DDIs. I see exactly what you mean and I support the question (better if I had the answer Laugh).
What is it used for on the LinuxMCE?
I want to start a project with Skype integration, but I'm stuck with the same question...

I'll monitor this thread.

--mr. kav

- how did you integrate skype with asterisk?
- LinuxMCE have a built-in softphone in their system using asterisk server in the background, but i have not yet looked into which softphone they are implementing (im currently looking for command shell based softphones, if such exist, then its only a matter of making a user interface for it inside xbmc and maybe use a bluetooth headset with it)
Reply
#6
found something called LinPhone (http://www.linphone.org) which has a command line deamon (linphonec). I tried it on my xbmc machine, and i get the phone to ring (actually on top of the audio of xbmc - i had a movie running) but the control was from the command shell, and when answering, i could hear the calling party, but i could not setup a mic on my xbmc box (i actually tried it very quick)

still don't know if LinPhone can be controlled via scripting, they mention a "linphonecsh" on their website for script integration, but its not out yet.

im running my xbmc on ubuntu 9.04, simply "sudo apt-get install linphone" will install it
Reply
#7
megacrypto Wrote:- how did you integrate skype with asterisk?
- LinuxMCE have a built-in softphone in their system using asterisk server in the background, but i have not yet looked into which softphone they are implementing (im currently looking for command shell based softphones, if such exist, then its only a matter of making a user interface for it inside xbmc and maybe use a bluetooth headset with it)
I integrated it using Skype for Asterisk, but you can also register for Skype SIP beta program and you'll get it for free. I also tried some SIP-Skype bridge applications, but that was dodgy and never worked twice Smile

The thing I don't get is. You're sitting on your couch, the VoIP line receives a call, you have an indication on your screen and then what?? The HTPC mic starts transmitting yoru voice like a headset?
Reply
#8
mr. kav Wrote:I integrated it using Skype for Asterisk, but you can also register for Skype SIP beta program and you'll get it for free. I also tried some SIP-Skype bridge applications, but that was dodgy and never worked twice Smile

I registered for the Skype SIP some time ago, but never followed through on trying it (i think i still have the links for it somewhere in my mailbox)

mr. kav Wrote:The thing I don't get is. You're sitting on your couch, the VoIP line receives a call, you have an indication on your screen and then what?? The HTPC mic starts transmitting yoru voice like a headset?

That is one option in LinuxMCE they have a video on youtube showing one of the developers using a mic and their "orbiter" to make and answer phone calls from the HTPC, but other than that i think you just use your voip phone set.

What i want to look into is one of those bluetooth headsets, and if the phone call is processed on top of whatever is playing on the tv (like a movie) then it would make sense to integrate a softphone into the HTPC using this bluetooth headset. Still im nowhere near trying that out.
Reply
#9
Hi megacrypto!

I've started a project which covers the features you mentioned on your initial post, plus a few more.

I would like you to take a look and join us make it possible/complete.
Take a look here: http://forum.xbmc.org/showthread.php?tid=71206

Thanks!
Hernan.-
Reply
#10
hmr Wrote:Hi megacrypto!

I've started a project which covers the features you mentioned on your initial post, plus a few more.

I would like you to take a look and join us make it possible/complete.
Take a look here: http://forum.xbmc.org/showthread.php?tid=71206

Thanks!
Hernan.-

it looks very promising, unfortunately right now im stuck in a work project that is killing my time and i will be for the next few weeks (this is the first time i check what is going on around here since a month) but i promise i will get back to you on this and i hope that you dont lose interest in the matter meanwhile.

cheers
Reply
#11
hmr, megacrypto - any progress? Would be awesome to get OSD notifications for calls/chat messages et cetera...

See also the call for add ons:
http://xbmc.org/theuni/2010/07/07/submit-your-add-ons/

and a number of related xbmc/skype threads:
http://forum.xbmc.org/tags.php?tag=skype
Reply

Logout Mark Read Team Forum Stats Members Help
Asterisk (VoIP) Plugin / Script Development0