Problems with outgoing calls via DAHDI

Hi everybody,

I am having the following problems,

I am not able to use my five DAHDI channels to call to PSTN, Here is a simple about what is going on here:

exten => _9.,1,Dial(DAHDI/2/${EXTEN:1})

My test pabx is behind an other PABX, when I Dial 9 + 0(context of the other pabx) + , my log file shows it:

– Executing [9032812800@phones1:1] Dial(“SIP/suporte1-00000014”, “DAHDI/2/032812800”) in new stack
– Called 2/032812800
– DAHDI/2-1 answered SIP/suporte1-00000014

It seems to be ok, but, there is no tone, and it doesn’t call the other number, i have others contexts to receive calls using the same DAHDI channel, and it works well.

The other problem is not very important, i created a loop with while to incoming calls, but if the caller hangup the call, the loop continues, it doesn’t happen if the called hangs up, only when the caller do it. (I have the hanguponpolarityswitch in my dahdi channel configuration file, here is the macro loop.

exten => s,1,Set(COUNT=0)
exten => s,n,Dial(${ARG1},${DIALTIMEOUT},Ttr)
exten => s,n(groupcheck),GotoIf($[${COUNT} < 10]?grouptry1:allbusy)
exten => s,n(grouptry1),While($[${COUNT} < 10])
exten => s,n,Macro(check-group,${ARG1},${ARG2},${ARG3})
exten => s,n,Set(COUNT=$[${COUNT} + 1])
exten => s,n,NoOp(COUNT was set to ${COUNT})
exten => s,n,EndWhile
exten => s,n,Goto(groupcheck)
exten => s,n(allbusy),Hangup()

exten => s,1(firsttry),Dial(${ARG1},${DIALTIMEOUT},Ttr)
exten => s,n,GotoIf($["${DIALSTATUS}" != “ANSWER”]?secondtry:)
exten => s,n(secondtry),Dial(${ARG2},${DIALTIMEOUT},Ttr)
exten => s,n,GotoIf($["${DIALSTATUS}" != “ANSWER”]?thirttry:)
exten => s,n(thirttry),Dial(${ARG3},${DIALTIMEOUT},Ttr)
exten => s,n,GotoIf($["${DIALSTATUS}" != “ANSWER”]?lasttry:)
exten => s,n(lasttry),Dial(${ARG3},${DIALTIMEOUT},Ttr)