I’ve bought a license for the current version of Cepstral Swift and am struggling to use it correctly within my phpagi script. If someone could point me in the right direction, I’d be very grateful.
My system configuration is Asterisk 13.5.0 on Ubuntu 14.04.3 LTS.
I have no problem using swift calls from a dialplan command like this: same => n,swift(Hello user. How are you today?)
However, I was unable to get any of the built-in swift calls in phpagi to work and the only solution I could find for successfully using the current version of swift within a phpagi script was to call it like this:$agi->exec("swift","Hello\ user\ How\ are\ you\ today");
This seemed to work well until I completed my script and began testing in earnest. After half a dozen tests, I found that the Asterisk console began reporting the error: astobj2.c:129 INTERNAL_OBJ: bad magic number for object 0xe7aab0. Object is likely destroyed
and this continued until Asterisk crashed.
I was able to reproduce the problem in the following simple script:
[code]#!/usr/bin/php -q
<?php /* Simple script to show crashing behaviour */ require('phpagi.php'); $agi = new AGI(); $agi->answer(); $counter=1; while ($counter < 30){ $agi->exec("swift","$counter"); $counter++; } $agi->hangup(); ?>[/code]which produces the following console output:
-- Executing [403@from-internal:1] Answer("SIP/103-00000000", "") in new stack
-- Executing [403@from-internal:2] Wait("SIP/103-00000000", "1") in new stack
-- Executing [403@from-internal:3] AGI("SIP/103-00000000", "swift-test.php") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/swift-test.php
-- AGI Script Executing Application: (swift) Options: (1)
-- AGI Script Executing Application: (swift) Options: (2)
-- AGI Script Executing Application: (swift) Options: (3)
...lines removed...
-- AGI Script Executing Application: (swift) Options: (23)
-- AGI Script Executing Application: (swift) Options: (24)
-- AGI Script Executing Application: (swift) Options: (25)
[2015-09-08 08:40:41] ERROR[22478][C-00000001]: astobj2.c:129 INTERNAL_OBJ: bad magic number for object 0x1389ab0. Object is likely destroyed.
[2015-09-08 08:40:41] ERROR[22478][C-00000001]: astobj2.c:129 INTERNAL_OBJ: bad magic number for object 0x1389ab0. Object is likely destroyed.
....hundreds more identical error messages removed...
[2015-09-08 08:40:41] ERROR[22478][C-00000001]: astobj2.c:129 INTERNAL_OBJ: bad magic number for object 0x1389ab0. Object is likely destroyed.
-- <SIP/103-00000000>AGI Script swift-test.php completed, returning 4
== Spawn extension (from-internal, 403, 3) exited non-zero on 'SIP/103-00000000'
-- Executing [h@from-internal:1] Hangup("SIP/103-00000000", "") in new stack
== Spawn extension (from-internal, h, 1) exited non-zero on 'SIP/103-00000000'
[2015-09-08 08:40:50] ERROR[22478][C-00000001]: astobj2.c:129 INTERNAL_OBJ: bad magic number for object 0x1389ab0. Object is likely destroyed.
[2015-09-08 08:40:50] ERROR[22478][C-00000001]: astobj2.c:129 INTERNAL_OBJ: bad magic number for object 0x1389ab0. Object is likely destroyed.
[2015-09-08 08:40:50] ERROR[21432]: astobj2.c:126 INTERNAL_OBJ: bad magic number 0x5000d00 for object 0x1389ab0
[2015-09-08 08:40:50] ERROR[21432]: astobj2.c:126 INTERNAL_OBJ: bad magic number 0x5000d00 for object 0x1389ab0
asterisk*CLI>
Disconnected from Asterisk server
Asterisk cleanly ending (0).
Executing last minute cleanups
If you can suggest a solution or workaround, I’d be really grateful. I’ve spent far too long diagnosing the problem (I wasn’t initially sure that it was swift that was causing the crashes and had to eliminate other elements in my code).
Thanks in advance,
Malcolm