[asterisk-dev] Question on the SIPPTest class in the testsuite

nitesh bansal nitesh.bansal at gmail.com
Fri Oct 12 04:50:36 CDT 2012


Hello,

I have included this patch in my source code and also included the code for
CLI command "core waitfullybooted", but it does not resolve my problem. I
am running a testcase which spawn two instances of asterisk, where
first asterisk is placing a call to second asterisk. Here is the extract of
my run-test:

-----------------------------------------------------------
   def ami_connect(self, ami):
      if ami.id == 0:
         print "Asterisk 1 fully started"
         self.receiving_asterisk = ami
         self.receiving_asterisk_booted = 1
         self.receiving_asterisk.registerEvent('UserEvent',
self.fax_gateway_result)

      if ami.id == 1:
         print "Asterisk 2 fully started"
         self.calling_asterisk = ami
         self.calling_asterisk_booted = 1

      if (self.calling_asterisk_booted == 1 and
self.receiving_asterisk_booted == 1):
         #Both the asterisk have booted, setup the call
         print "Sending a call from ast2 to ast1"
         self.calling_asterisk.registerEvent('UserEvent', self.fax_result)
         carrier_channel_variables =
{'SIPADDHEADER51':'X-VCC-UUID:XE6RL7GAXFHIBHBECK7G5PZ6AM',
'SIPADDHEADER52':'X-VCC-Provider:61 127.0.0.2
BEL','SIPADDHEADER53':'X-VCC-CallType:voxfax'}
         df = self.calling_asterisk.originate(channel =
"sip/ast1-g711/1234", context = "sendfax", exten = "1234", priority =
"1",variable = carrier_channel_variables)

         def handle_failure(reason):
            print "Failed to send originate"
            print reason.getTraceback()
            self.stop_reactor()

            return reason

         df.addErrback(handle_failure)
-------------------------------------------------------------

Bit when i run my testcase, i see that call is placed before asterisk has
loaded its diaplan.

This is what i see in the logs:

----------------------------------------------------------------------------
[Oct 12 11:47:09] INFO[4489]: asterisk.TestCase:98 __init__: Executing
tests/channels/SIP/VoxFax_G711
[Oct 12 11:47:09] INFO[4489]: asterisk.TestCase:143 create_asterisk:
Creating Asterisk instance 1
[Oct 12 11:47:10] INFO[4489]: asterisk.TestCase:143 create_asterisk:
Creating Asterisk instance 2
[Oct 12 11:47:20] INFO[4489]: asterisk.TestCase:255 __start_asterisk:
Starting Asterisk instance 1
[Oct 12 11:47:20] INFO[4489]: asterisk.TestCase:255 __start_asterisk:
Starting Asterisk instance 2
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:123 connectionMade:
Asterisk 127.0.0.1 - connection made
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:123 connectionMade:
Asterisk 127.0.0.2 - connection made
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:600 cli_exec: Executing
['/usr/sbin/asterisk', '-C',
'/tmp/asterisk-testsuite/channels/SIP/VoxFax_G711/ast1/etc/asterisk/asterisk.conf',
'-rx', 'core waitfullybooted'] ...
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:600 cli_exec: Executing
['/usr/sbin/asterisk', '-C',
'/tmp/asterisk-testsuite/channels/SIP/VoxFax_G711/ast2/etc/asterisk/asterisk.conf',
'-rx', 'core waitfullybooted'] ...
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:62 __cli_output_callback:
Asterisk CLI 127.0.0.1 exited 1
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:63 __cli_output_callback:
Unable to connect to remote asterisk (does
/tmp/asterisk-testsuite/channels/SIP/VoxFax_G711/ast1/var/run/asterisk.ctl
exist?)

[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:263
__wait_fully_booted_error: Asterisk core waitfullybooted failed, attempting
again...
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:600 cli_exec: Executing
['/usr/sbin/asterisk', '-C',
'/tmp/asterisk-testsuite/channels/SIP/VoxFax_G711/ast1/etc/asterisk/asterisk.conf',
'-rx', 'core waitfullybooted'] ...
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:62 __cli_output_callback:
Asterisk CLI 127.0.0.2 exited 0
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:63 __cli_output_callback:
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:62 __cli_output_callback:
Asterisk CLI 127.0.0.1 exited 0
[Oct 12 11:47:21] DEBUG[4489]: asterisk.asterisk:63 __cli_output_callback:
[Oct 12 11:47:21] INFO[4489]: asterisk.TestCase:167 create_ami_factory:
Creating AMIFactory 1
[Oct 12 11:47:21] INFO[4489]: asterisk.TestCase:167 create_ami_factory:
Creating AMIFactory 2
[Oct 12 11:47:21] INFO[4489]: AMI:136 connectionMade: Connection Made
[Oct 12 11:47:21] INFO[4489]: AMI:136 connectionMade: Connection Made


-----------------------------------------------------------------------------

You will observe in the logs that __cli_output_callback is printing an
empty string. To debug it further, i launched asterisk manually and
lanuched command "sudo asterisk -rx "core waitfullybooted" from another
terminal, it seems to be working fine for me.

Any suggestions to debug it further are most welcome.

Regards,
Nitesh Bansal

On Fri, Oct 5, 2012 at 5:04 PM, Paul Belanger
<paul.belanger at polybeacon.com>wrote:

> On 12-10-05 04:11 AM, nitesh bansal wrote:
>
>> I am using the Asterisk Version 1.4.
>>
>> As per the logs, it looks that asterisk has not loaded the dialplan yet,
>> the problem can be reproduced on Asterisk 1.4 by putting a bogus address
>> in
>> res_mysql.conf, which will result in asterisk trying to connect to
>> this bogus address and it will increase the loading time of asterisk.
>>
>> Remark;
>> "I just checked that core waitfully booted" does not exist on 1.4, so
>> probably i am likely to have this problem on 1.4"
>>
>>  So you must be using a version of asterisk before 1.4.33, if so you'll
> have to manually backport the patch[1].  Basically, the testsuite didn't
> exist before that, so there is no guarantee if will work either.
>
> [1] http://svnview.digium.com/svn/**asterisk?view=revision&**
> revision=265570<http://svnview.digium.com/svn/asterisk?view=revision&revision=265570>
>
>
> --
> Paul Belanger | PolyBeacon, Inc.
> Jabber: paul.belanger at polybeacon.com | IRC: pabelanger (Freenode)
> Github: https://github.com/pabelanger | Twitter:
> https://twitter.com/pabelanger
>
> --
> ______________________________**______________________________**_________
> -- Bandwidth and Colocation Provided by http://www.api-digital.com --
>
> asterisk-dev mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/**mailman/listinfo/asterisk-dev<http://lists.digium.com/mailman/listinfo/asterisk-dev>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20121012/bdfa5cfa/attachment.htm>


More information about the asterisk-dev mailing list