Workaround for PAI to work on Yeastar gateways.
Sourced from Yeastar: https://docs.google.com/document/d/1hWRfW6DYslk6lnngbcWjFT6QcgMFAhi-y89TtC66REw/
NOTE: Sample GnCustomCfg is also attached to this KB.
1) - Add Custom config patch
There is a problem for TE that it could not load all the custom config lines of the extensions_custom.conf. So we need to add this patch first.
1 - Download the patch file from this link: https://drive.google.com/file/d/11OoUI9uuA7QVAnZt6SaDd3Q-eMjEDjx1/view?usp=sharing
2 - Login the TE FTP and copy the file into the persistent folder.
FTP login guide: https://support.yeastar.com/hc/en-us/articles/217380628-How-to-Access-FTP-Folder
3 - Login the SSH of TE to create a script to load GnCustomCfg when system boots.
Login SSH followed by this article: How to Log in SSH?
cd /persistent, create a file add.sh, then put the content into the script.
#!/bin/sh
sleep 30
cp /persistent/GnCustomCfg /www/MyCGI
chmod 777 /www/MyCGI/GnCustomCfg
4 - reboot TE to let the change take effect
2) - Add PAI & Diversion Header for SIP INVITE
In the following, we introduce a solution by customizing the config file.
It requires the Linux knowledge to accomplish. Especially the VI command. Also the knowledge of the custom config method: How to Create Custom Config Files in Yeastar Device.
If you don't know how to handle this solution. You can try to seek help from your IT or a Linux skilled technician..
1 - Login SSH followed by this article: How to Log in SSH?
2 - Create extensions_custom.conf in the /persistent/custom-cfg/ via SSH. And fill in the content in extensions_custom.conf
Replace XXX, YYY as required. If you need to invoke A Party caller ID, you can use this string to replace XXX/YYY : ${CALLERID(num)}
[macro-trunkdial-failover-0.3]
exten = s,1,NOOP(do call out)
exten = s,2,GotoIf(${DB_EXISTS(oblacklist/${ARG3})}?Blacklist-Handle,s,1)
exten = s,3,Gotoif($[${LEN(${FromSystemAlert})}>0]?6:4)})
exten = s,4,Gotoif($[${LEN(${ARG$[${ARG1}+4]})}>0]?5:6)
exten = s,5,Authenticate(${ARG$[${ARG1}+4]})
exten = s,6,Set(TCOUNT=4)
exten = s,n,Set(CDR(userfield)=Outbound)
exten = s,n,Set(OldCallerID=${IF($[${LEN(${MACRO_CONTEXT:13})} > 0]?${MACRO_CONTEXT:13}:${PINUSER_CONTEXT:13})})
exten = s,n,Set(TOUCH_MONITOR=${OldCallerID}-${ARG3})
exten = s,n,NOOP(${DOD_${ARG${TCOUNT}}_${OldCallerID}})
exten = s,n,Set(TIMEOUT(absolute)=${IF($[${LEN(${ABSOLUTE_TIMEOUT_${OldCallerID}})} > 0]?${ABSOLUTE_TIMEOUT_${OldCallerID}}:${ABSOLUTE_TIMEOUT})})
exten = s,n,Set(DLSTAT=UNKNOW})
exten = s,n,SetCktCustom(sendrpid,no,no)
exten = s,n,Gotoif(${ARG1}>0?1-dial,1)
exten = 1-dial,1,Gotoif($[$[${TCOUNT}-3]>${ARG1}]?nextrouter,1)
exten = 1-dial,2,Gotoif($[${LEN(${DOD_${ARG${TCOUNT}}_${CALLERID(num)}})} > 2]?setdod,1:1-dial,3)
exten = 1-dial,3,Set(CALLERID(name)=${IF($[${LEN(${CID_${ARG${TCOUNT}}})} > 2]?${CID_${ARG${TCOUNT}}}:${CALLERID(name)})})
exten = 1-dial,4,Set(CALLERID(num)=${IF($[${LEN(${CID_${ARG${TCOUNT}}})} > 2]?${CID_${ARG${TCOUNT}}}:${CALLERID(num)})})
exten = 1-dial,5,Set(_SIPSRTP=${SIPPEER(${ARG${TCOUNT}},srtpcapable)})
exten = 1-dial,6,Set(OUTDIALOPT=${IF($[${LEN(${GSM_${ARG${TCOUNT}}})} > 0]?tTkKWwXxr:${DIALOPTIONS})})
exten = 1-dial,7,NOOP(null for std)
exten = 1-dial,8,Gotoif($[${LEN(${FromSystemAlert})}>0]?sys-dial,1)})
exten = 1-dial,9,SIPAddHeader(P-Asserted-Identity: "XXX" <sip:XXX@spark.co.nz>)
exten = 1-dial,10,SIPAddHeader(Diversion: "YYY" <sip:YYY@spark.co.nz>)
exten = 1-dial,11,Ringing()
exten = 1-dial,12,Dial(${${ARG${TCOUNT}}}/${ARG2}${PREFIX_${ARG${TCOUNT}}}${ARG3},,${OUTDIALOPT})
exten = 1-dial,n,Goto(1-${DIALSTATUS},1)
exten = sys-dial,1,Macro(sysdial,${${ARG${TCOUNT}}}/${ARG2}${PREFIX_${ARG${TCOUNT}}}${ARG3},,${OUTDIALOPT})
exten = setdod,1,Set(CALLERID(name)=${DOD_${ARG${TCOUNT}}_${CALLERID(num)}})
exten = setdod,2,Set(CALLERID(num)=${DOD_${ARG${TCOUNT}}_${CALLERID(num)}})
exten = setdod,3,Goto(1-dial,5)
exten = 1-BUSY,1,Set(DLSTAT=9-${DIALSTATUS})
exten = 1-BUSY,2,Goto(2-dial,1)
exten = 1-CHANUNAVAIL,1,Set(DLSTAT=9-${DIALSTATUS})
exten = 1-CHANUNAVAIL,2,Goto(2-dial,1))
exten = 1-CONGESTION,1,Set(DLSTAT=9-${DIALSTATUS})
exten = 1-CONGESTION,2,Goto(2-dial,1)
exten = 2-dial,1,Set(TCOUNT=$[${TCOUNT}+1])
exten = 2-dial,2,Goto(1-dial,1)
exten = 1-out,1,playback(all-busy-now-try-call-later,noanswer)
exten = 1-out,2,Hangup()
exten = 9-BUSY,1,playback(all-busy-now-try-call-later,noanswer)
exten = 9-BUSY,2,Hangup()
exten = 9-CHANUNAVAIL,1,playback(all-busy-now-try-call-later,noanswer)
exten = 9-CHANUNAVAIL,2,Hangup()
exten = 9-CONGESTION,1,playback(all-busy-now-try-call-later,noanswer)
exten = 9-CONGESTION,2,Hangup()
exten = nextrouter,1,GotoIf($[${LEN(${NEXTROUTER})} > 0]?${NEXTROUTER},${ORGINEXTEN},1:${DLSTAT},1)
exten = h,1,NOOP(no thing to do)
Save the file and quit.
3 - Input commands:
mypbxconf
asterisk -rx "dialplan reload"
4 - Make call tests.
Was this article helpful?
That’s Great!
Thank you for your feedback
Sorry! We couldn't be helpful
Thank you for your feedback
Feedback sent
We appreciate your effort and will try to fix the article