News & Reviews
More How-To's & Tips More News
More Reviews Device Configuration Tools
No account yet? Create one
Forgot your Username or Password?

Welcome to the Voxilla VoIP Forum.

Voxilla has been a trusted source for accurate, up-to-date information on the IP Communications industry since 2002. A dedicated staff of reporters and engineers produce feature articles and product reviews to keep industry watchers abreast of the people, companies, and trends driving a fast moving market.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact contact us.





Reply
 
LinkBack Thread Tools Rate Thread Display Modes
  #1 (permalink)  
Old November 29th, 2007, 09:03 PM
jsree jsree is offline
Junior Member
 
Join Date: Sep 2006
Posts: 15
jsree
Default Asterisk 1.4.13:Howto run AGI on gtalk incoming msg

Hi

Asterisk 1.4.13 works with GoogleTalk.
JABBER: gtalk_account INCOMING: <message to="buddy@gmail.com" type="chat" id="92" from="buddy2<A href="mailto:buddy2@gmail.com/Talk.v1049A93112B"><body>CALL ME</body><active">@gmail.com/Talk.v1049A93112B"><body>CALL ME</body><active xmlns="<A href="http://jabber.org/protocol/chatstates"/><nos:x">http://jabber.org/protocol/chatstates"/><nos:x value="disabled" xmlns:nos="google:nosave"/><arc:record otr="false" xmlns:arc="<A href="http://jabber.org/protocol/archive"/></message">http://jabber.org/protocol/archive"/></message>

if I get CALL ME command I like to call my cell phone and get connection to buddy@gmail.com

Please let me know how to run agi script on gtalk incomming message

thanks in Advance

Jay
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old December 16th, 2007, 12:23 AM
jsree jsree is offline
Junior Member
 
Join Date: Sep 2006
Posts: 15
jsree
Default Re: Asterisk 1.4.13:Howto run AGI on gtalk incoming msg

Hi

finally using perl/manager interface my asterisk server start chatting with gtalk client.

Created two accounts in Manger.conf for chatter, gchat

save the following lines as gtalk.pl (run the code as ./gtalk.pl yourname buddyname)
#!/usr/bin/perl -w
#file name: gtalk.pl
#usage ./gtalk.pl urname buddy
#urname, buddy are valid gmail user and both user added them in gtalk buddy list
use POE::Session;
use XML::Simple;
use Digest::MD5 qw(md5_hex);
use Asterisk::Manager;
my ($myname, $buddy) = @ARGV;
my $gusers = {
$buddy.'@gmail.com'

[top]> 1,
};
use POE::Component::Client::Asterisk::Manager;
my $xml


new XML::Simple;
POE::Component::Client::Asterisk::Manager->new(
Alias => 'monitor',
RemoteHost => 'localhost',
RemotePort => 5038, # default port
Password => 'xyzXYZ',
Username => 'gchat',
CallBacks => {
ring => {
'Event' => 'JabberEvent',
'Account' => 'gtalk_account',
},
},
inline_states => {
ring => sub {
my $input = $_[ARG0];
my $packet = $input->{Packet};
if ($packet ne '') {
my $data = $xml->XMLin($packet);
print $data->{from}."\n";
my $username = "";
if ($data->{from} =~ m{(.*?)/}) {
$username = $1;
}
if ((exists $gusers->{$username}) and ($data->{type} =~ /chat/)) {
&processCall($data);
}elsif ($data->{from} =~ /$myname/) {
}elsif ($data->{type} =~/chat/) {
&sendJabberMsg($username,"Only Voice Chat Please");
&sendJabberMsg($username,"$username Have a Nice Day");
}
}
},
},
);

POE::Kernel->run();
die;
sub processCall {

my ($data) = @_;
my $username = "";
if ($data->{from} =~ m{(.*?)/}) {
$username = $1;
}
if ($data->{body} =~ /Help\s*$/) {
&sendJabberMsg($username,"Help -- for Help");
&sendJabberMsg($username,"Connect nnnn - connect Gtalk to extenison nnnn");
}elsif($data->{body} =~ /Connect\s+(\d\d\d\d)/) {
&sendJabberMsg($username,"Please Accept $1 connection", $1) ;
}else {
&sendJabberMsg($username,"Invalid CMD $data->{body}") ;
}
}

sub sendJabberMsg {
my ($username, $msg, $exten) = @_;
my $astman = new Asterisk::Manager;
$astman->user('chatter');
$astman->secret('aaachat');
$astman->host('localhost');
$astman->connect||die "Count not connect to" .$astman->host."\n";
my %resp = $astman->sendcommand( Action => 'JabberSend',
Jabber => 'gtalk_account',
ScreenName => $username,
Message => $msg
);
if (defined $exten) {
%resp = $astman->sendcommand(
Action =>"Originate",
Channel => "Gtalk/gtalk_account/$username",
Context => "from-internal",
CallerId => $username,
Exten => $exten,
Timeout =>30000,
Priority => 1

);
foreach $key (keys %resp) {
print "$key %resp{$key)\n";
}
}
$astman->disconnect;

}
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes Rate This Thread
Rate This Thread:



Similar Threads for: Asterisk 1.4.13:Howto run AGI on gtalk incoming msg
Thread Thread Starter Forum Replies Last Post
Howto Configure Efonia with Asterisk jsree Asterisk Support Forum 1 December 5th, 2006 02:50 AM
ENUM Howto for Asterisk at Home kevank Asterisk Support Forum 0 April 26th, 2006 07:35 AM
Run Asterisk@Home 2.5 on a Windows PC ... Honest! AlexanderBell Asterisk Support Forum 2 February 9th, 2006 02:06 PM
MSG Waiting Off syscon Linksys (Sipura) VoIP Support Forum 3 August 30th, 2005 01:26 AM
Run platform in asterix from remote server? paranhos Asterisk Support Forum 3 June 16th, 2005 07:33 PM



All times are GMT. The time now is 12:35 PM.


vBulletin, Copyright ©2000 - 2009, Jelsoft Enterprises Ltd. SEO by vBSEO 3.0.0 ©2007, Crawlability, Inc. Logos and trademarks are the property of Voxilla or their respective owner. All other content © 2003-2007 by Voxilla, Inc.