Hello everybody,
for 2 days I’m testing this phrase in extension.conf:

exten => _0XXX.,1,Set(status=${DEVICE_STATE(DAHDI/G1)})
exten => _0XXX.,n,NoOp(SIP/status 2 has state ${status})

exten => _0XXX.,n,GotoIf("$(status}" = “unknown”]?SIP1:ISDN1)

exten => _0XXX.,n(ISDN1),Set(status=“busy”)
exten => _0XXX.,n,Dial(DAHDI/G1/${EXTEN},r,)
exten => _0XXX.,n,Hangup()

exten => _0XXX.,n(SIP1),SipAddHeader(P-Preferred-Identity:sip:49XXXXXXX@sipconnect.sipgate.de))
exten => _0XXX.,n,Dial(SIP/${EXTEN}@sipconnect.sipgate.de,r,)

exten => _0XXX.,n,Hangup()

This is Asterisk telling:

– Executing [0XXXXXXXXXXX@intern:7] SIPAddHeader(“SIP/50-00000000”, “P-Preferred-Identity:sip:49XXXXXXXXXXX@sipconnect.sipgate.de)”) in new stack
– Executing [0XXXXXXXXXXX@intern:8] Dial(“SIP/50-00000000”, “SIP/0XXXXXXXXXXX@sipconnect.sipgate.de,r,”) in new stack
== Using SIP RTP CoS mark 5
– Called SIP/0XXXXXXXXXXX@sipconnect.sipgate.de
– SIP/sipconnect.sipgate.de-00000001 is making progress passing it to SIP/50-00000000
– SIP/sipconnect.sipgate.de-00000001 is ringing

My Asterisk 1.8 is connected via a Sangoma B700 to ISDN and also to a VOIP Trunk.
I succeed to dial out without any problem in a simple DIAL(), also with changed dialout number. But using the gotoif()-function, I’m not able to change the dialout number.
Who knows a solution?

Missing “$[”. ALso, an explanation of how it is supposed to work would have been useful.

Thanks for reply!
I checked the $[ . In fact there should be a ) instead of a ] at the end of the phrase.
The result is the same.
“SipAddHeader(P-Preferred-Identity:<sip:49XXXXXXX@sipconnect.sipgate.de” isn’t working correct!

exten => _0XXX.,n,GotoIf([color=#FF0000]$[[/color]"$(status}" = “unknown”]?SIP1:ISDN1)

I thought you originally said that adding the header worked and had the desired effect and that it was the Goto that didn’t work.

As I’ve never heard of that header before (Remote-Party-ID, which is uspported natively, and P-Asserted-Identity are used for caler-ID when From: is used for other purposes).

Hi David55,
Sending the header with a normal DIAL() command out of extensions.conf is working fine, but if I try to do this after a gotoif() command, it fails!

Hello everybody,
I found the solution of this problem:
the SIP provider gave a wrong information!
The right way to use SipAddHeader is: SIPAddHeader(“SIP/50-00000000”, "P-Preferred-Identity:sip:49XXXXXXXXXXX@sipconnect.sipgate.de)")
Without < >!