Outbound for sip numbers with AMP


I’ll try to explain in my bad english, sorry by advance.

  1. Is it possible to create an outbound trunk to call external sip numbers like foo@domain.tld with AMP ?

  2. Is is possible to call a SIP number like foo@domain.tld with an IAX softphone (kiax under Linux) ?

My tries :
about 1) after reading a lot everywhere, and because I never found a solution with AMP, I just added :

exten => _0.,1,Dial(SIP/${EXTEN:1}@${SIPDOMAIN},30,r) exten => _0.,2,Congestion exten => _0.,3,Hangup
at the end of my extensions.conf.
I don’t really know if it doesn’t borke my AMP config a little, but it works with my SIP softphone. I can place a call to foo@domain.tld nicely.

But, I’d prefer to do it with AMP because, it might be the solution for 2) and maybe I have some things not working and I don’t realize it for the moment.

about 2) when I place a call with my IAX softphone, I have an error :

And iax2 debug gives me :

Timestamp: 00003ms SCall: 00897 DCall: 00000 [] VERSION : 2 CALLING NUMBER : xxxxxxx CALLING NAME : XXXXXX FORMAT : 1024 CAPABILITY : 1542 USERNAME : 300 CALLED NUMBER : 0foo DNID : 0foo CALLED CONTEXT : domain.tld

I doesn’t seem to pass throught the same way, but I don’t really know why.
I can’t put here all my config, because it’s very AMP dependent and it’s very long.
But, if someone knows AMP sufficiently, maybe he will be able to help me.

Thanks in advance,

No idea or bad explanation ?

For 2), I found something is that @domain.tld is considered as the context, so, I had to replace “@” in my call by something like “_”, and substitute it in Dialplan, like :

; dial sip numbers
exten => _sip:.,1,SetVar(SIPNUM=${EXTEN:4}) ; remove sip: prefix

exten => _sip:.,n,GotoIf(${REGEX("@" ${SIPNUM})}?fromsip:fromiax) ; test where comes from
exten => _sip:.,n,Dial(SIP/${EXTEN:4}@${SIPDOMAIN},30,r) ; call sip number normaly
exten => _sip:.,n,Goto(end)

exten => sip:.,n(fromiax),GotoIf(${REGEX("" ${SIPNUM})}:end) ; go to end if no "_"
exten => sip:.,n,Cut(NUM=SIPNUM,,1) ; get sip extention
exten => sip:.,n,Cut(DOM=SIPNUM,,2) ; get sip domain
exten => _sip:.,n,Dial(SIP/${NUM}@${DOM},30,r) ; call SIP/$NUM@$DOM

exten => _sip:.,n(end),Congestion
exten => _sip:.,n,Hangup[/code]

There surely are some things to improve.
And I would prefer to call with a “@” in my IAX softphone. If someone can see a solution…