tag:blogger.com,1999:blog-2156539095375223979.post8359940270500122144..comments2024-03-20T03:35:01.157-04:00Comments on Ken's Unified Communications Blog: Re-routing Incoming Lync Calls to AutoAttendant Using MSPL ScriptingKen Laskohttp://www.blogger.com/profile/14298995806059683301noreply@blogger.comBlogger20125tag:blogger.com,1999:blog-2156539095375223979.post-78731575462851554152014-08-20T10:14:02.880-04:002014-08-20T10:14:02.880-04:00The 'return' shouldn't make a differen...The 'return' shouldn't make a difference since its part of the 'if' statement. I would make sure you have the proper quotes around things. I would try copying and pasting the section that works, and just modifying the number slightly. Maybe you're overflowing a variable with the log statement being too long? Weird though, because the error seems to indicate a problem with an integer variable, while we're using strings everywhere. Send me the entire script in email and I'll have a peek.<br /><br />KenKen Laskohttps://www.blogger.com/profile/14298995806059683301noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-39508888419123872922014-08-20T10:05:48.857-04:002014-08-20T10:05:48.857-04:00Hey Ken,
Thanks for the quick reply and the insig...Hey Ken,<br /><br />Thanks for the quick reply and the insight! For question 2 - as soon as I get the 'if' statement issue fixed I'll probably create a global list which I'll apply to the sites.<br /><br />As for the script, here's what I have. If I comment out the second If statement it works fine. Adding the second statement blows the whole thing up. Does the 'return' within the if statement cause an issue maybe?<br /><br /> //<br /> // Look for SITE1 AUTO ATTENDANT +15552229999@domain.com in the sipRequest object<br /> // This is the Attendant no. <br /> //<br /> if (ContainsString(toUserAtHost, "+15552229999@domain.com", true)) <br /> {<br /> Log("Event", 0, "ReroutePilotNumtoAA: Autoattendant match. Re-routing +15552229999 to Site1 Auto Attendant", toUserAtHost);<br /> <br /> Respond("302","Moved Temporarily","Contact=");<br /> <br /> // Return initiative to Lync.<br /> return;<br /> }<br /> //<br /> // Look for SITE2 AUTO ATTENDANT +445552229999@domain.com in the sipRequest object<br /> // This is the Attendant No. <br /> //<br /> if (ContainsString(toUserAtHost, "+445552229999@domain.com", true)) <br /> {<br /> Log("Event", 0, "ReroutePilotNumtoAA: Autoattendant match. Re-routing SITE2 DID hook +445552229999 to SITE2 Auto Attendant", toUserAtHost);<br /> <br /> Respond("302","Moved Temporarily","Contact=");<br /> <br /> // Return initiative to Lync.<br /> return;<br /> }<br /> <br /> // Return initiative to Lync/Default Routing.<br /> return;Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-41667030323339669892014-08-20T09:38:00.195-04:002014-08-20T09:38:00.195-04:00I don't see any reason why adding a second IF ...I don't see any reason why adding a second IF statement shouldn't work. Check your syntax. Here's the relevent part. Just change the phone number and SIP domain:<br /><br /> if (ContainsString(toUserAtHost, "+15552229999@contoso.com", true)) <br /> {<br /> Log("Event", 0, "ReroutePilotNumtoAA: Autoattendant match. Re-routing +15552229999 to Autoattendant", toUserAtHost);<br /> <br /> Respond("302","Moved Temporarily","Contact=");<br /> <br /> // Return initiative to Lync.<br /> return;<br /> }<br /><br />As for #2, you certainly can run variants of this in two or more central sites. The script processing is local to the server, so there shouldn't be any issue with running a different variant on another server. In your situation, you will definitely want to do this, because calls coming into the second site will stay local to that site, so you will need this script running on the local servers to capture it.<br /><br />KenKen Laskohttps://www.blogger.com/profile/14298995806059683301noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-75034363846829133382014-08-20T09:31:06.687-04:002014-08-20T09:31:06.687-04:00Hey Ken,
Thanks for the info, I got the sample sc...Hey Ken,<br /><br />Thanks for the info, I got the sample script to work without an issue for one auto-attendant. Couple of questions here though:<br />1) How do we add another auto-attendant in the same script? I've tried adding another 'if' clause by basically copying the sample if clause that works and changing its properties to match the second auto attendant. In this case however I get an ugly Error: System.Data.SqlClient.SqlException (0x80131904): The conversion of the varchar value '4294967295' overflowed an int column. I tried 'else' and 'else if' as well but get the same error. Would I need to add a file for each auto-attendant?<br /><br />2)What are your thoughts on running this in a two or more central site scenarios (for example Europe and North America)? Do you see the need to run two or more instances of the custom app pointing to the script(one on each FE)? I'm guessing this would be required if users from another site call the main number that is supposed to be redirected to the AA via internal routing?<br /><br />Cheers,<br />MaxAnonymousnoreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-59506013687489092632014-02-11T11:51:16.830-05:002014-02-11T11:51:16.830-05:00Unfortunately, I'm not much of an expert in MS...Unfortunately, I'm not much of an expert in MSPL scripting. Another Lync MVP, Michael Greenlee (who I link to in the above post), can likely answer your question much better than me.<br /><br />KenKen Laskohttps://www.blogger.com/profile/14298995806059683301noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-44589058362278073422014-02-09T08:03:19.121-05:002014-02-09T08:03:19.121-05:00Hi Ken,
I managed to fix the issue by adding a sta...Hi Ken,<br />I managed to fix the issue by adding a static route in lync that routes the URI provided by your script to the correct IP address of my attendant server.<br /><br />However now I have another issue :)<br /><br />The SIP INVITE that come from Lync / application script, doesn't include SDP.<br />Or better, Lync uses multipart SDP .<br />Unfortunately, non-Lync endpoints generally don’t support the multipart/alternative content type for the SDP, and so to them it appears that the message is malformed or missing the SDP.<br /><br />So, my new question for you is: <br />Are you able to modify your script in order to add a valid (standard) SDP message into the SIP INVITE?<br /><br />Please let me know<br />Thank you for your timeAnonymoushttps://www.blogger.com/profile/00635977186040695000noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-32608988312132632202014-02-08T17:04:22.628-05:002014-02-08T17:04:22.628-05:00Hi Ken,
Thank you for sharing this cool script.
I ...Hi Ken,<br />Thank you for sharing this cool script.<br />I tried it and I can see it works as expected.<br />I need to route an incoming call to another attendant server (not a Lync response group or an individual Lync user) on the same network of my Lync server. <br /><br />The following should be the scenario:<br /><br />PSTN_GW (+584365540) -> MS Lync -> PSTN_GW (sip:6440@sas.imagicle.com)<br /><br />Is it possible to do this with your script?<br /><br />I can call the attendant server (a normal Lync gateway) from a Lync user by calling 6440, so I customized your script in according:<br />--------------------------------------------------------------------------------------------------------------------<br />if (ContainsString(toUserAtHost, "+584365540@imagicle.com", true)) <br /> {<br /> Log("Event", 0, "ReroutePilotNumtoAA: Autoattendant match. Re-routing +584365540 to Autoattendant", toUserAtHost); <br /> Respond("302","Moved Temporarily","Contact=");<br />--------------------------------------------------------------------------------------------------------------------<br /><br />However when external incoming call come to my Lync server, I get "404 Not Found" message:<br /><br />--------------------------------------------------------------------------------------------------------------------<br />TL_INFO(TF_PROTOCOL) [1]0914.0F00::02/08/2014-21:25:35.425.0028adae (SIPStack,SIPAdminLog::TraceProtocolRecord:SIPAdminLog.cpp(125))$$begin_record<br />Trace-Correlation-Id: 2813426983<br />Instance-Id: 000A378A<br />Direction: outgoing;source="local"<br />Peer: lync2010.imagicle.com:59482<br />Message-Type: response<br />Start-Line: SIP/2.0 404 Not Found<br />From: "Johnny G.";epid=89DB34F77D;tag=565389f8e0<br />To: ;tag=2A311F279EC1E2914A023015157E5839<br />CSeq: 111070 INVITE<br />Call-ID: f264168a-b6bf-44c3-be67-2b16f63f4f71<br />ms-application-via: monitorlync.imagicle.com_;ms-server=LYNC2010.imagicle.com;ms-pool=lync2010.imagicle.com;ms-application=51FB453D-5B9F-45df-83B4-ADD1F7E604A8<br />Via: SIP/2.0/TLS 192.168.4.40:59482;branch=z9hG4bKb59f069;ms-received-port=59482;ms-received-cid=2687100<br />ms-diagnostics: 1003;reason="User does not exist";TargetUri="6440@sas.imagicle.com";source="LYNC2010.imagicle.com"<br />Server: RTC/4.0<br />Content-Length: 0<br />Message-Body: –<br />$$end_record<br />--------------------------------------------------------------------------------------------------------------------<br /><br />Can you help me to fix this issue?<br /><br />Thanks in advance<br />Anonymoushttps://www.blogger.com/profile/00635977186040695000noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-52398901688611051722013-05-02T10:44:21.295-04:002013-05-02T10:44:21.295-04:00I don't see any reason to change the priority....I don't see any reason to change the priority. Glad it works in 2013.<br /><br />KenKen Laskohttps://www.blogger.com/profile/14298995806059683301noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-203140484466818392013-05-02T10:43:14.269-04:002013-05-02T10:43:14.269-04:00Thanks, yeah realised that as I wrote it :)
Shoul...Thanks, yeah realised that as I wrote it :)<br /><br />Should it be placed as priority 2 in a 2013 environment?<br /><br />Thanks again<br />Anonymoushttps://www.blogger.com/profile/16198786669556264889noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-60237462188549800792013-05-02T10:15:01.147-04:002013-05-02T10:15:01.147-04:00In the URI, try using http://www.x.com/ReRoutePilo...In the URI, try using http://www.x.com/ReRoutePilotNumbertoAA instead.<br /><br />KenKen Laskohttps://www.blogger.com/profile/14298995806059683301noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-64236097421991856912013-05-01T17:38:30.596-04:002013-05-01T17:38:30.596-04:00Hi,
I had this working lovely on a 2010 but I'...Hi,<br /><br />I had this working lovely on a 2010 but I'm having trouble migrating my mediation services across. When I use it I get this:<br /><br />Configured application uri for script-only application did not match application uri in path.<br /><br />Path: C:\MSPLScripts\ReroutePilotNumtoAA.am<br />Cause: Powershell cmdlets do not parse the contents of the path so they can't detect if the application uri specified in the path matches the application uri specified via the cmdlet.<br />Resolution:<br />Fix the application uri using Set-CSServerApplication cmdlet to match the application uri in the path.<br /><br />Identity : Service:Registrar:pool2013.x.com/RerourePilotNumbertoAA<br />Priority : 2<br />Uri : http://pool2013.x.com/ReroutePilotNumbertoAA<br />Name : RerourePilotNumbertoAA<br />Enabled : True<br />Critical : False<br />ScriptName : C:\MSPLScripts\ReroutePilotNumtoAA.am<br />Script :<br />Anonymoushttps://www.blogger.com/profile/16198786669556264889noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-17971939322317926702013-03-22T11:06:49.670-04:002013-03-22T11:06:49.670-04:00Hey Ken
I did what you said but no luck,
My IV...Hey Ken<br /><br /><br />I did what you said but no luck, <br /><br />My IVR TEL URI is +12345678111;ext=1550<br />MY IVR SIP URI is ivr@mytricks.in<br /><br />in script I have mentioned my number as +12345678111 without extension number. Please let me know if I am missing anything. Please check below script..<br /><br />Thanks in advance..<br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br /><br />Santoshhttps://www.blogger.com/profile/15259596629628155631noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-57155196253523045582013-03-20T09:18:32.593-04:002013-03-20T09:18:32.593-04:00Hey Santosh,
My script will only allow you to forw...Hey Santosh,<br />My script will only allow you to forward to SIP URIs, not actual phone numbers. Your IVR number will have a SIP URI associated with it (assuming its a Lync Response Group). Use that instead of the number, and it should work fine.<br /><br />KenKen Laskohttps://www.blogger.com/profile/14298995806059683301noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-19512856971867651572013-03-18T15:20:52.094-04:002013-03-18T15:20:52.094-04:00Hi Ken,
In my environment we are using one DID fo...Hi Ken,<br /><br />In my environment we are using one DID for all user's as we don't have extension for all users. So I am using MSPL Scripting to route calls to main number i.e. IVR.<br />In my case I want to route calls made to 123456789 (user DID) to 9876543210 (ivr)<br /><br />e.g.<br />User DID's,<br />123456789x1200<br />123456789x1201<br />Main NUmber ie IVR - 9876543210<br /><br />I have followed your guide but no luck. Is inbound normalization rule is required for routing? Please let me know if I am missing anything..<br /><br />Thanks in advance.Santoshhttps://www.blogger.com/profile/15259596629628155631noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-34179552704642259012012-08-02T10:35:36.834-04:002012-08-02T10:35:36.834-04:00Hi Mike,
You only have to apply this script on you...Hi Mike,<br />You only have to apply this script on your mediation servers. <br /><br />KenKen Laskohttps://www.blogger.com/profile/14298995806059683301noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-73032863263169952142012-07-31T10:44:24.713-04:002012-07-31T10:44:24.713-04:00Hi,
We're running independent Edge / Mediatio...Hi,<br /><br />We're running independent Edge / Mediation server roles. Can you confirm if this needs to be applied on both servers or just the Mediation server?<br /><br />Many thanks,<br /><br />MikeMikehttp://escanti.netnoreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-14742978514064592772012-06-19T08:29:23.865-04:002012-06-19T08:29:23.865-04:00Hi Nick,
Yes you can use this script to forward ca...Hi Nick,<br />Yes you can use this script to forward calls to any SIP URI. It can be an autoattendant, a response group or even just a individual user.<br /><br />In your case, make sure you also assign an extension to your response group, or you will still get the ambiguous issue.<br /><br />KenKen Laskohttps://www.blogger.com/profile/14298995806059683301noreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-27933332916225346132012-06-19T04:05:58.647-04:002012-06-19T04:05:58.647-04:00Hi Ken,
I read this and saw it is only for AA , b...Hi Ken,<br /><br />I read this and saw it is only for AA , but I work with 5 Response Groups.<br />eg one has the number +3237778810 . If there is not user defined with that line URI it works fine, but as soon as I assign tel:+3237778810;ext=15 to a user it stops working.<br />Can I use this script also for that problem ?Nick Loendersnoreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-55651846576501884032012-05-01T02:24:25.180-04:002012-05-01T02:24:25.180-04:00Hi Ken
I am getting invalid Path for script-only a...Hi Ken<br />I am getting invalid Path for script-only application error.. Any suggestions?Anonymousnoreply@blogger.comtag:blogger.com,1999:blog-2156539095375223979.post-40321195363646070702012-03-02T08:17:06.143-05:002012-03-02T08:17:06.143-05:00Thank you for sharing this detailed summary.Thank you for sharing this detailed summary.SIP Providerhttp://www.siptrunkingproviders.org/noreply@blogger.com