PJSIP_ENDPOINT in macro-dialout-trunk-predial-hook

Is it possible to use PJSIP_ENDPOINT in macro-dialout-trunk-predial-hook?
I have a few PBX networked together, and for the outbound route to the carrier it need to send a specific SIP header per PBX (billing purposes).
Have managed to use:
[macro-dialout-trunk-predial-hook]
exten => s,1,Noop(Adding X-billing)
exten => s,n,ExecIf($[“${REALCALLERIDNUM}”=“12345678”]?Set(Customer=PBX1))
exten => s,n(PBX1),NoOp(Incoming call from PBX number 1)
exten => s,n,GoSubIf($[“${Customer}”=“PBX1”]?func-set-sipheader,s,1(X-billing))
exten => s,n,MacroExit()

This setup works, but if I have 50 DID, this list would be long.
Using PJSIP_ENDPOINT based on name of the endpoint would simplify a lot.

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.