cancel
Showing results forĀ 
Search instead forĀ 
Did you mean:Ā 
cancel
658
Views
0
Helpful
2
Replies

Help with ce9.9 macro to recognize when an IP is dialed and add URI

milfredo
Level 1
Level 1

Hi there,

 

we have created a nice 'external services' macro that dials into Webex, bluejeans or Zoom depending on the users selection. One of the entries is for the user to select 'other' where they can enter and IP or URI... What we'd like, is that when an IP is entered, the macro adds @ip.address at the end so the call manager can send the call via sip.

 

This is an excerpt of what I have so far:

 

case PHONECALLDIALPAD_ID:
fixedStringToDial=event.Text;
if (fixedStringToDial.length>0)
{
if (fixedStringToDial.includes=("@")) {fixedStringToDial=fixedStringToDial};
}
else
{
console.log("Not URI, assuming IP: ",fixedStringToDial);
fixedStringToDial=fixedStringToDial+'@ip.address';
}

xapi.command("dial", {Number: fixedStringToDial});
console.log("Actual dial string: ",fixedStringToDial);
isInOtherCall=1;

break;

 

This is the log from the GUI:

 

16:08:56CallConferenceMultiAppjsTypeError: cannot write property includes' of '199.48.152.152' at [anon] (duk_hobject_props.c:4193) internal at [anon] (CallConferenceMultiAppjs:367) strict at [anon] (extensions/xapi.js:8264) strict at _dispatch (extensions/xapi.js:3978) strict at [anon] (extensions/xapi.js:3982) strict preventsyield at forEach () native strict preventsyield at _dispatch (extensions/xapi.js:3983) strict at [anon] (extensions/xapi.js:3982) strict preventsyield at forEach () native strict preventsyield at _dispatch (extensions/xapi.js:3983) strict at [anon] (extensions/xapi.js:3982) strict preventsyield [...]367

 

Can anyone assist?

2 Replies 2

milfredo
Level 1
Level 1

can anyone help?? :)

You seem to be having an issue with the .includes bit.

Try using .indexof instead:

if (fixedStringToDial.indexof("@") == -1) {
  console.log("Not URI, assuming IP: ",fixedStringToDial);
  fixedStringToDial=fixedStringToDial+'@ip.address';
}
Wayne

Please remember to mark helpful responses and to set your question as answered if appropriate.