Server hangs before dialing

Discussions on how to install

Moderator: guy

Server hangs before dialing

Postby nick on Tue Nov 24, 2009 2:29 pm

Hello,

I have installed AsteriskC2D on an asterisk server running version 1.6.1.0

It is set up and runs successfully using the curl command and the iphone app.

The only issue im having is that the program seems to hang for about 15 seconds before dialling the first phone(or even contacting asterisk), even when using the curl command on the server.

Is this an issue with my setup, or is a bug or unavoidable delay?

I am running the webserver on the asterisk server, and authenticating using a local file (although i will update to ldap at some point)

If there is any more information i can provide for you just ask.

Many thanks

Nick
nick
 
Posts: 4
Joined: Tue Nov 24, 2009 2:14 pm

Re: Server hangs before dialing

Postby guy on Tue Nov 24, 2009 2:37 pm

Hmmm sounds like a DNS issue... are you using the IP address of the Asterisk server or it's hostname? if hostname try using the IP address in the CURL or iphone client application.

Cheers,
---Guy
guy
Site Admin
 
Posts: 86
Joined: Sun Jul 01, 2007 10:55 am
Location: UK

Re: Server hangs before dialing

Postby nick on Tue Nov 24, 2009 3:09 pm

I was using hostname, but have now tried it with host name and with the servers ip address but still get the same delay.

Any ideas?

Thanks

Nick
nick
 
Posts: 4
Joined: Tue Nov 24, 2009 2:14 pm

Re: Server hangs before dialing

Postby guy on Tue Nov 24, 2009 3:18 pm

hmmm when you look in the logs on the webserver does it show you the IP address you connected from or the hostname? It's possible that you've configured the webserver logs to also do this lookup?

Also one other test... if you try to use CURL from a shell on the asterisk server and use 127.0.0.1 as the web address does it still work slowly?

If so then it's likely something screwy in the script... can you paste the changes you've made to the script to customise it for your site? Changing any passwd as necessary

---Guy
guy
Site Admin
 
Posts: 86
Joined: Sun Jul 01, 2007 10:55 am
Location: UK

Re: Server hangs before dialing

Postby nick on Tue Nov 24, 2009 3:47 pm

I have tried 127.0.0.1 and got the same delay,

my webserver logs are showing 127.0.0.1 from the curl command, and the ip i connected from from the iphone app.

This is the code, i havent made too many changes to it.

    #!/usr/bin/perl


    # 1 for LDAP, 2 for MySQL, 0 to use a file
    my $authMethod = 0;
    # Asterisk server IP or hostname
    my $server_ip = '127.0.0.1';
    # Username in the manager.conf file which is allowed to connect.. you have enabled it right! :)
    my $clickUser = 'AsteriskC2D';
    # the password associated with the above username
    my $ClickPassword = '****';

    # LDAP server configuration bits
    ###########################################################################
    # LDAP server used to authenticate the users expecting to click and dial
    my $LDAPServer = 'ldap.example.com';
    # prefix for the usernames eg uid=rho,cn=users,dc=00
    my $UID ='uid';
    # where in the LDAP to look for the users to authenticate
    my $LDAPSearch = 'ou=people,dc=example,dc=com';
    ###########################################################################

    # MySQL authentication support
    # Trixbox support
    ###########################################################################
    # Use MySQL for authentication, mainly for TrixBox Support
    # mysql Server usually localhost
    my $MySQLserver = 'localhost';
    # username
    my $dbusername = 'asteriskuser';
    # Password
    my $dbpasswd = 'amp109';
    # database name
    my $database = 'asterisk';
    # tablename
    my $table = 'sip';
    # query for
    my $dbquery = 'select data from sip where keyword=\'secret\' and id=';
    ###########################################################################

    # file based authentication configuration
    ###########################################################################
    my $authFile = '/etc/AsteriskC2D.users';
    ###########################################################################


    # contexts in extensions.conf to start matching to dialing strings etc.
    my $context = 'Dialplan1';
    #The callerID to put on the phone you are Dialing FROM!!!..
    #This puts the name ClickDial and the number your dialing!
    my $CIDName = 'ClickDial';

    # Enable logging?
    my $LOGGING = 1;
    # where to log?
    my $LOGFILE = '/tmp/click.log';

    if ($LOGGING) {open (LOG,">>$LOGFILE");}

Thanks

Nick
nick
 
Posts: 4
Joined: Tue Nov 24, 2009 2:14 pm

Re: Server hangs before dialing

Postby guy on Tue Nov 24, 2009 4:11 pm

hmm that's very strange...

can you let me have access to your PBX to take a look? You can send me the access details to my private e-mail address...guy at rho dot cc

Cheers,
---Guy
guy
Site Admin
 
Posts: 86
Joined: Sun Jul 01, 2007 10:55 am
Location: UK

Re: Server hangs before dialing

Postby nick on Wed Nov 25, 2009 9:54 am

Thanks, but i have solved it!

i'm running asterisk 1.6.1, so the command "$tn->waitfor('/0\n$/');" is waiting for a 0 that doesn't exist,
changing it to "$tn->waitfor('/1\n$/');" solved it, and your script runs almost instantly.

Many thanks,

Nick
nick
 
Posts: 4
Joined: Tue Nov 24, 2009 2:14 pm

Re: Server hangs before dialing

Postby pugu on Thu May 13, 2010 8:05 am

I hit this problem too, but using this solution makes it dial instantly, rather than the 12 seconds it was taking before! Thanks!
pugu
 
Posts: 9
Joined: Mon May 10, 2010 2:50 pm


Return to Installation

Who is online

Users browsing this forum: No registered users and 1 guest

cron