[Asterisk-Users] AGI Dial, Extension dial SIP Loop

Stefan de Konink
Mon, 19 Jul 2004 06:52:50 -0000

At the moment I'm prototyping an advanced ENUM application with PHP
fetched from LDAP. When a user enters a full hostname as SIP adress I get
loop problems from the AGI EXECUTE DIAL and from a Dial in the
extension.conf.

    -- Executing AGI("SIP/1000-c3c3", "enum.php") in new
stack
    -- Launched AGI Script /var/lib/asterisk/agi-bin/enum.php
  enum.php: 123
  enum.php: 3170327xxxx
  enum.php: LDAP bind successful...
  enum.php: telephoneNumber=3170327xxxx,ou=People,dc=eshara
  enum.php: sip:1000@xxx.xxx.xxx.xxx
  enum.php: in: sip:1000@xxx.xxx.xxx.xxx
  enum.php: uit: sip/1000@xxx.xxx.xxx.xxx
  enum.php: in: sip:1000@xxx.xxx.xxx.xxx
  enum.php: uit: sip/1000@xxx.xxx.xxx.xxx
    -- AGI Script enum.php completed, returning 0
    -- Executing Dial("SIP/1000-c3c3",
"sip/1000@xxx.xxx.xxx.xxx") in new
stack
    -- Called 1000@xxx.xxx.xxx.xxx
    -- Got SIP response 482 "Loop Detected" back from xxx.xxx.xxx.xxx
  == No one is available to answer at this time
    -- Executing Hangup("SIP/1000-c3c3", "") in new stack
  == Spawn extension (default, 3170327xxxx, 3) exited non-zero on
'SIP/1000-c3c3'


But when I skip the @asterisk.blabla.bla it strangely works from the
extension.conf but not from the AGI script directly.

Now I set a variable, and then call do a:

AGI:
 write("SET VARIABLE CALLTHIS
".uri2tech($info[0]['description'][0]));
Extension:
 Dial(${CALLTHIS})

    -- AGI Script enum.php completed, returning 0
    -- Executing Dial("SIP/1000-a5c0", "sip/1000") in new
stack
    -- Called 1000
    -- SIP/1000-d8a9 is ringing
  == Spawn extension (default, 3170327xxxx, 2) exited non-zero on
'SIP/1000-a5c0'


I want to know why it fails with:
write("EXEC Dial ".uri2tech($info[0]['description'][0]));

Is there a way to get this to work without stripping the hostname part?
How did other users solve this problem while using ENUM as backend and
calling locally?


Greetings,

Stefan de Konink