Digium Switchvox Event Trigger Errors

Talk with others about developing applications for Switchvox

Moderators: bmdhacks, dpodolsky, tristand, jwitt, joshuas

Digium Switchvox Event Trigger Errors

Postby chickasaw » Mon Apr 09, 2012 12:48 pm

Switchvox Problem
I am employed at Chickasaw Electric and we are having a problem. I am trying to get the phone extensions to be recognized with a specific computer's IP address. I currently have PERL running on my local host, to interpret the actions done in Digium Switchvox. I have set up Event Triggers in Digium Switchvox and the other employees are having a delay when they answer the phone, meaning that when the phone rings and they say "hello" nobody is on the other end for 2 or 3 seconds. I have contacted Digium Switchvox and according to them we are having a timeout error. I am creating this program to interpret Event Triggers in Digium Switchvox. Below is the code that I have entered into Switchvox Event Triggers.

http://localhost:portnumber/route.cgi_n ... _ID_NUMBER%&cid_name=%CALLER_ID_NAME%cgi_extension=%EXTENSION%
chickasaw
Newsterisk
 
Posts: 2
Joined: Mon Apr 09, 2012 12:17 pm

Re: Digium Switchvox Event Trigger Errors

Postby dpodolsky » Mon Apr 09, 2012 1:09 pm

I don't quite understand what the issue exactly is. Do you think the Event Triggers are causing the delay on the answer? Or did you set up Event Triggers to try to figure out what was causing the delay? If you remove the Event Triggers there isn't a delay? Also, that URL you are using, did you put this in only one Event Trigger or are you having this fire for every trigger in the system?
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm

Re: Digium Switchvox Event Trigger Errors

Postby chickasaw » Wed May 02, 2012 3:27 pm

I do think that Event Triggers are causing a delay on the phone calls. That is correct, when I remove the Event Triggers there is no longer a delay on any of the phone call. And yes, I am only using the System Default URL and pointing back Event Specific URLs back to the System Default URL.
A customer calls in and a Chickasaw Electric employee answers the phone. This sends the Chickasaw Electric employees phone number and IP address to the server, thus forcing the Screenpop to kick in.

Here is what I need: 1) Somebody calls in to Chickasaw Electric. 2) Event Triggers then kick in. 3) Data is then sent to my PERL program. (BELOW IS MY CODE)

#!/usr/bin/perl
#tcpserver.pl

use IO::Socket::INET;

# flush after every write
$| = 1;

my ($socket,$client_socket);
my ($peeraddress,$peerport);

# creating object interface of IO::Socket::INET modules which internally does
# socket creation, binding and listening at the specified port address.
$socket = new IO::Socket::INET (
LocalHost => 'localhost',
LocalPort => 'port number',
Proto => 'tcp',
Listen => 15,
Reuse => 1
) or die "ERROR in Socket Creation : $!\n";

print "Server Waiting for client connection on port 7071";

while(1)
{
# waiting for new client connection.
$client_socket = $socket->accept();

# get the host and port number of newly connected client.
$peer_address = $client_socket->peerhost(),
$peer_port = $client_socket->peerport(),

print "Accepted New Client Connection From : $peeraddress, $peerport\n";

# write operation on the newly accepted client.
$data = "DATA from Server";
print $client_socket "$data\n";
# we can also send the data through IO::Socket::INET module,
$client_socket->send($data);

# read operation on the newly accepted client
$data = <$client_socket>;
# we can also read from socket through recv() in IO::Socket::INET
# $client_socket->recv($data,1024);
print "Received from Client : $data\n";
}

$socket->close();

4) The customers phone number and the Chickasaw Electric employee’s phone extension is sent from the Switchvox Event Trigger to the PERL program. 5) I will be using IF statements to link the Chickasaw Electric employees phone extension and IP address. 6) The customer’s phone number and the Chickasaw Electric employees IP address is then sent to another server port, that has the information to run the Screenpop application based on the information that was provided. 7) Screenpop then kicks in, thus allowing our program to open with the customer’s information.

My PERL Program currently creates a new port on the local host, thus allowing command prompt to be executed with the information, such as the Chickasaw Electric employee’s extension, the customer’s name, and number. Upon the completion of PERL it should execute steps 4-6, thus sending data to a certain port and allowing the Screenpop application to be executed containing the customers provided information.

I spoke with Digium Support and according to them a possible reason for my error is that no XML file is being sent back to the Swithvox server thus causing timeout error.
chickasaw
Newsterisk
 
Posts: 2
Joined: Mon Apr 09, 2012 12:17 pm

Re: Digium Switchvox Event Trigger Errors

Postby dpodolsky » Thu May 03, 2012 9:31 am

So the code you posted is your web service that accepts the HTTP request from the event trigger? It looks like you are over complicating the solution by writing a custom web server. Also I don't see the proper response codes returns (200 OK) that would signal that your request is over, thus causing the event trigger to wait for a timeout and your delay *probably around 5 seconds).

Again I may be missing this part from your example but I suggest you install a real web server like lighttpd and use FastCGI or apache + mod_perl. They make writing web services super easy. Then you can hit up your screen pop application.

Also another thing to pay attention to is long processing times. The PBX won't continue with its processing of the call until the web request returns. So if your web server has a high latency or takes a long time to process then the PBX will be waiting for the response and cause the delay.
dpodolsky
Oldsterisk
 
Posts: 325
Joined: Thu Apr 23, 2009 2:35 pm


Return to Switchvox Developers

Who is online

Users browsing this forum: No registered users and 1 guest