<div dir='auto'>Ah, you have to rewrite the callee, not the caller! <div dir="auto">Then it is possible.</div><div dir="auto">So yes, my initial solution will work.</div><div dir="auto">You set emergency_suffix in subs preferences as I said.</div><div dir="auto">Then in the inbound rewrite rules for the callee you rewrite ^(11[0-9]) into emergency_${emergency_suffix}_\1.</div><div dir="auto"><br></div><div dir="auto">So the number from normal subscriber should be rewritten into emergency_110, but calls from 720 subs will be emergency_invalidAC_110.</div><div dir="auto"><br></div><div dir="auto">If you have problems, just create a special rewrite rules set for users 720 instead of adding the rule in generic domain's rewrite rule set.</div><div dir="auto"><br></div><div dir="auto"><br></div><div dir="auto">Then in outbound rewrite rule for callee in your peer you will have 2 rules:</div><div dir="auto"><br></div><div dir="auto"><span style="font-size: 11pt; font-family: calibri, sans-serif; color: rgb(31, 73, 125);">^emergency_(.+)$ </span><span style="font-size: 11pt; color: rgb(31, 73, 125);"><font face="wingdings">----></font></span><span style="font-size: 11pt; font-family: calibri, sans-serif; color: rgb(31, 73, 125);">${caller_cc}${caller_ac}\1</span><br></div><div dir="auto"><br></div><div dir="auto">And with highest precedence:</div><div dir="auto"><br></div><div dir="auto"><span style="font-size: 11pt; font-family: calibri, sans-serif; color: rgb(31, 73, 125);">^emergency_invalidAC_(.+)$ </span><span style="font-size: 11pt; color: rgb(31, 73, 125);"><font face="wingdings">---></font></span><span style="font-size: 11pt; font-family: calibri, sans-serif; color: rgb(31, 73, 125);"> 431\1</span></div><div dir="auto"><span style="font-size: 11pt; font-family: calibri, sans-serif; color: rgb(31, 73, 125);"><br></span></div><div dir="auto"><span style="font-family: sans-serif;"> in this way you should achieve what you want.</span><br></div><div dir="auto"><br></div><div dir="auto"><span style="font-size: 11pt; font-family: calibri, sans-serif; color: rgb(31, 73, 125);">Daniel</span></div><div class="gmail_extra" dir="auto"><br></div><div class="gmail_extra" dir="auto"><br><div class="gmail_quote">On Jan 6, 2017 9:44 PM, Matthias Hohl <matthias.hohl@telematica.at> wrote:<br type="attribution"><blockquote class="quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Hello,</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">yes this is an austrian specific issue with this 0720 AC for emergency calls.</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">If you try to call an emergency number (120, 122, 133 or whatever) you get this back:</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 17:44:16 spce proxy[3717]: NOTICE: <script>: Setting caller_cli_userprov/caller_domain_userprov '43720266497@sip.telematica.at' for upn - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1385091644-19093-12@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 17:44:16 spce proxy[3717]: NOTICE: <script>: Setting From to '<sip:43720266497@sip.telematica.at>' - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1385091644-19093-12@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 17:44:16 spce proxy[3717]: NOTICE: <script>: Setting caller_cli_netprov/caller_domain_netprov '43720266497@sip.telematica.at' for npn - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1385091644-19093-12@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 17:44:16 spce proxy[3717]: NOTICE: <script>: Setting PAI to '<sip:43720266497@sip.telematica.at>' - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1385091644-19093-12@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 17:44:16 spce proxy[3717]: NOTICE: <script>: Rewriting called party 'emergency_144' to '43720144' - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1385091644-19093-12@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 17:44:16 spce proxy[3717]: NOTICE: <script>: Setting P-Called-Party-ID '<sip:43720144@92.63.158.30>' - R=sip:43720144@92.63.158.30:5060;transport=udp ID=1385091644-19093-12@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">...</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 17:44:17 spce proxy[3713]: NOTICE: <script>: NAT-Reply - S=484 - Address Incomplete M=INVITE</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Austrian regulatory doesn’t allow 720 as AC for emergency calls, so in case of an emergency call the AC „720“ must be rewritten to „1“ or any other valid AC from Austria. But „1“ for vienna should be the preferred AC.</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">The problem ist hat i have hundreds of subsribers with 43 720 numbers out there, so patching it manually on every subscriber device is no real deal to make this work.</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Must better would be a rewrite rule solution that makes a IF request: </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">IF emergency call detected AND if B area code is 43 720 THEN rewrite area code to 43 1.</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">This would be the best fitting solution for this problem, cause i can set this globally on the server.</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">At the peering i have this rewrite rule for Outbound rewrite rules for callee:</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">^emergency_(.+)$ </span><span style="font-size:11pt;font-family:'wingdings';color:#1f497d">à</span><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> ${caller_cc}${caller_ac}\1</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">So it not about the number oft he caller it is just about the Rewrite rule the peer use fort he Callee to make from an emergency number a valid Caller CC and caller AC number.. and there he use the wrong Caller AC number in case of 43 720 numbers.</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">BTW: the solution i wrote several months ago with this „</span>${emergency_suffix}=invalidAC_<span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">“… what about this? What you meant with this in your first answer to this topic?</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Yes it would be very nice if you could provide me a solution for this… </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">In the meantime i use this workarround:</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">i open the subscriber settings and go to number manipulations and overwrite the Area code „720“ manually with „1“. Then i can place the call.</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 21:36:06 spce proxy[3707]: NOTICE: <script>: Setting caller_cli_userprov/caller_domain_userprov '43720266497@sip.telematica.at' for upn - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1108595425-19093-13@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 21:36:06 spce proxy[3707]: NOTICE: <script>: Setting From to '<sip:43720266497@sip.telematica.at>' - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1108595425-19093-13@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 21:36:06 spce proxy[3707]: NOTICE: <script>: Setting caller_cli_netprov/caller_domain_netprov '43720266497@sip.telematica.at' for npn - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1108595425-19093-13@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 21:36:06 spce proxy[3707]: NOTICE: <script>: Setting PAI to '<sip:43720266497@sip.telematica.at>' - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1108595425-19093-13@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 21:36:06 spce proxy[3707]: NOTICE: <script>: Rewriting called party 'emergency_144' to '431144' - R=sip:emergency_144@92.63.158.30:5060;transport=udp ID=1108595425-19093-13@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 21:36:06 spce proxy[3707]: NOTICE: <script>: Setting P-Called-Party-ID '<sip:431144@92.63.158.30>' - R=sip:431144@92.63.158.30:5060;transport=udp ID=1108595425-19093-13@BHC.BG.F.BAC UA='Grandstream GXP2130 1.0.7.97'</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">…</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d">Jan  6 21:36:07 spce proxy[3717]: NOTICE: <script>: NAT-Reply - S=183 - Session Progress</span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><span style="font-size:11pt;font-family:'calibri' , sans-serif;color:#1f497d"> </span></p><p><b><span style="font-size:11pt;font-family:'calibri' , sans-serif">Von:</span></b><span style="font-size:11pt;font-family:'calibri' , sans-serif"> Daniel Grotti [mailto:dgrotti@sipwise.com] <br><b>Gesendet:</b> Freitag, 6. Jänner 2017 18:24<br><b>An:</b> Matthias Hohl <matthias.hohl@telematica.at><br><b>Cc:</b> spce-user@lists.sipwise.com<br><b>Betreff:</b> Re: AW: AW: [Spce-user] Emergency Calls in Austria with 0720</span></p><p> </p><div><p>Hi, </p><div><p>Ok I see. I get it know.</p></div><div><p>You need a patch in kamailio to achieve that, cause you cannot modify the Caller number BASED on Callee number.</p></div><div><p>I can have a look at that and provide with a solution.</p></div><div><p> </p></div><div><p>Can't you allow your phones to set the From with the AC 1, and you add that number on your allowed_cli list as well as as ALIAS number of that subscriber ?</p></div><div><p>In this way they will go out always with 1, bit they can be called back. Or just add the alias, is that possible?</p></div><div><p>Sorry I don't know this 720 AC issue so well.</p></div><div><p> </p></div><div><p>Daniel</p></div></div><p><img width="1" height="1" style="width:0.0104in;height:0.0104in" src="http://t.sidekickopen65.com/e1t/o/5/f18dQhb0S7ks8dDMPbW2n0x6l2B9gXrN7sKj6v4LQ_-W2BpsbF8p-VDHN4WJ21WQFLCHW115b5_1k1H6H0?si=6582522784514048&pi=1792f66c-c6a9-4175-8019-20a1be2fd5df" alt="http://t.sidekickopen65.com/e1t/o/5/f18dQhb0S7ks8dDMPbW2n0x6l2B9gXrN7sKj6v4LQ_-W2BpsbF8p-VDHN4WJ21WQFLCHW115b5_1k1H6H0?si=6582522784514048&pi=1792f66c-c6a9-4175-8019-20a1be2fd5df"></p></div></div></blockquote></div><br></div></div>