[asterisk-users] trouble removing + sign
I'm using BLACKLIST() to check numbers, which does not like leading + signs. I want to test if there is a plus sign, and then remove it. I tried: ; strip leading plus sign same => n, Verbose( callerid 0:1 is ${CALLERID(num):0:1} ) same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num) = ${CALLERID(num):1}) same=>n,GotoIf(${BLACKLIST()}?make-em-wait) but it's stripping the first character + sign or not. The callerid is 1203XX -- Executing [s@hangup-spam:3] Verbose("PJSIP/2667075-000b", " callerid 0:1 is 1 ") in new stack callerid 0:1 is 1 -- Executing [s@hangup-spam:4] ExecIf("PJSIP/2667075-000b", "0?Set(CALLERID(num) = 203XXX") in new stack -- Executing [s@hangup-spam:5] GotoIf("PJSIP/2667075-000b", "0?make-em-wait") in new stack ExecIf correctly finds the comparison false(the "0"), but still executes the appiftrue . What am I missing ? -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] trouble removing + sign
Try == in your gotoif (instead of =) Regards, Dovid Original Message From: seandar...@gmail.com Sent: February 14, 2019 01:14 To: asterisk-users@lists.digium.com Reply-to: asterisk-users@lists.digium.com Subject: [asterisk-users] trouble removing + sign I'm using BLACKLIST() to check numbers, which does not like leading + signs. I want to test if there is a plus sign, and then remove it. I tried: ; strip leading plus sign same => n, Verbose( callerid 0:1 is ${CALLERID(num):0:1} ) same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num) = ${CALLERID(num):1}) same=>n,GotoIf(${BLACKLIST()}?make-em-wait) but it's stripping the first character + sign or not. The callerid is 1203XX -- Executing [s@hangup-spam:3] Verbose("PJSIP/2667075-000b", " callerid 0:1 is 1 ") in new stack callerid 0:1 is 1 -- Executing [s@hangup-spam:4] ExecIf("PJSIP/2667075-000b", "0?Set(CALLERID(num) = 203XXX") in new stack -- Executing [s@hangup-spam:5] GotoIf("PJSIP/2667075-000b", "0?make-em-wait") in new stack ExecIf correctly finds the comparison false(the "0"), but still executes the appiftrue . What am I missing ? -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] trouble removing + sign
On 2/13/19 6:22 PM, Dovid Bender wrote: Try == in your gotoif (instead of =) Regards, Dovid Original Message From: seandar...@gmail.com Sent: February 14, 2019 01:14 To: asterisk-users@lists.digium.com Reply-to: asterisk-users@lists.digium.com Subject: [asterisk-users] trouble removing + sign I'm using BLACKLIST() to check numbers, which does not like leading + signs. I want to test if there is a plus sign, and then remove it. I tried: ; strip leading plus sign same => n, Verbose( callerid 0:1 is ${CALLERID(num):0:1} ) same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num) = ${CALLERID(num):1}) same=>n,GotoIf(${BLACKLIST()}?make-em-wait) but it's stripping the first character + sign or not. The callerid is 1203XX -- Executing [s@hangup-spam:3] Verbose("PJSIP/2667075-000b", " callerid 0:1 is 1 ") in new stack callerid 0:1 is 1 -- Executing [s@hangup-spam:4] ExecIf("PJSIP/2667075-000b", "0?Set(CALLERID(num) = 203XXX") in new stack -- Executing [s@hangup-spam:5] GotoIf("PJSIP/2667075-000b", "0?make-em-wait") in new stack ExecIf correctly finds the comparison false(the "0"), but still executes the appiftrue . What am I missing ? -- Tried the double equal sign. Same result. sean -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] trouble removing + sign
Le 14/02/2019 à 00:12, sean darcy a écrit : I'm using BLACKLIST() to check numbers, which does not like leading + signs. I want to test if there is a plus sign, and then remove it. I tried: ; strip leading plus sign same => n, Verbose( callerid 0:1 is ${CALLERID(num):0:1} ) same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num) = ${CALLERID(num):1}) same=>n,GotoIf(${BLACKLIST()}?make-em-wait) but it's stripping the first character + sign or not. The callerid is 1203XX -- Executing [s@hangup-spam:3] Verbose("PJSIP/2667075-000b", " callerid 0:1 is 1 ") in new stack callerid 0:1 is 1 -- Executing [s@hangup-spam:4] ExecIf("PJSIP/2667075-000b", "0?Set(CALLERID(num) = 203XXX") in new stack -- Executing [s@hangup-spam:5] GotoIf("PJSIP/2667075-000b", "0?make-em-wait") in new stack ExecIf correctly finds the comparison false(the "0"), but still executes the appiftrue . What am I missing ? Try ExecIf($["x${CALLERID(num):0:1}" == "x+"]?Set(CALLERID(num) = ${CALLERID(num):1}) Or you could use somethjing like exten = _X.,1,NoOp(Your dialplan) same = n,... exten = _+.,1,Goto(${EXTEN:1},1) -- Daniel -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] trouble removing + sign
I think that is the supposed behaviour... Being true, it executes what you tell it to do and continues to the next priority. I would suggest you to try using gotoif instead, maybe it helps controlling the flow easily. Something like: same => n, Verbose(callerid 0:1 is ${CALLERID(num):0:1}) same => n, GotoIf($["${CALLERID(num):0:1}" = "+"]?remove:send) same => n(remove),Set(CALLERID(num) = ${CALLERID(num):1}) same => n(send),Verbose(called number is ${CALLERID(num)) same => n,GotoIf(${BLACKLIST()}?make-em-wait) On Thu, Feb 14, 2019 at 12:06 AM sean darcy wrote: > On 2/13/19 6:22 PM, Dovid Bender wrote: > > Try == in your gotoif (instead of =) > > > > > > > > > > Regards, > > > > Dovid > > > > > > > > Original Message > > > > > > > > From: seandar...@gmail.com > > Sent: February 14, 2019 01:14 > > To: asterisk-users@lists.digium.com > > Reply-to: asterisk-users@lists.digium.com > > Subject: [asterisk-users] trouble removing + sign > > > > > > I'm using BLACKLIST() to check numbers, which does not like leading + > > signs. I want to test if there is a plus sign, and then remove it. > > > > I tried: > > > >; strip leading plus sign > > same => n, Verbose( callerid 0:1 is ${CALLERID(num):0:1} ) > > same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num) = > > ${CALLERID(num):1}) > > same=>n,GotoIf(${BLACKLIST()}?make-em-wait) > > > > but it's stripping the first character + sign or not. The callerid is > > 1203XX > > > > -- Executing [s@hangup-spam:3] Verbose("PJSIP/2667075-000b", " > > callerid 0:1 is 1 ") in new stack > >callerid 0:1 is 1 > > -- Executing [s@hangup-spam:4] ExecIf("PJSIP/2667075-000b", > > "0?Set(CALLERID(num) = 203XXX") in new stack > > -- Executing [s@hangup-spam:5] GotoIf("PJSIP/2667075-000b", > > "0?make-em-wait") in new stack > > > > ExecIf correctly finds the comparison false(the "0"), but still executes > > the appiftrue . > > > > What am I missing ? > > > > > > -- > > Tried the double equal sign. Same result. > > sean > > > > -- > _ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > Check out the new Asterisk community forum at: > https://community.asterisk.org/ > > New to Asterisk? Start here: > https://wiki.asterisk.org/wiki/display/AST/Getting+Started > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: >http://lists.digium.com/mailman/listinfo/asterisk-users -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] trouble removing + sign
On Wed, Feb 13, 2019 at 06:12:58PM -0500, sean darcy wrote: > same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num) = > ${CALLERID(num):1}) ExecIf($["${CALLERID(num):0:1}"="+"]?Set(CALLERID(num)=${CALLERID(num):1})) > ExecIf correctly finds the comparison false(the "0"), but still executes the > appiftrue . Executes the appiftrue or just shows what could be executed? -- Stefan Tichy ( asterisk3 at pi4tel dot de ) -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] trouble removing + sign
The format of Set is Set(MYVAR=myval) not Set(MYVAR = myval) On 02/13/2019 06:12 PM, sean darcy wrote: I'm using BLACKLIST() to check numbers, which does not like leading + signs. I want to test if there is a plus sign, and then remove it. I tried: ; strip leading plus sign same => n, Verbose( callerid 0:1 is ${CALLERID(num):0:1} ) same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num) = ${CALLERID(num):1}) same=>n,GotoIf(${BLACKLIST()}?make-em-wait) but it's stripping the first character + sign or not. The callerid is 1203XX -- Executing [s@hangup-spam:3] Verbose("PJSIP/2667075-000b", " callerid 0:1 is 1 ") in new stack callerid 0:1 is 1 -- Executing [s@hangup-spam:4] ExecIf("PJSIP/2667075-000b", "0?Set(CALLERID(num) = 203XXX") in new stack -- Executing [s@hangup-spam:5] GotoIf("PJSIP/2667075-000b", "0?make-em-wait") in new stack ExecIf correctly finds the comparison false(the "0"), but still executes the appiftrue . What am I missing ? -- http://help.nyigc.net/ -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Re: [asterisk-users] trouble removing + sign
On 2/14/19 4:23 AM, Administrator TOOTAI wrote: Le 14/02/2019 à 00:12, sean darcy a écrit : I'm using BLACKLIST() to check numbers, which does not like leading + signs. I want to test if there is a plus sign, and then remove it. I tried: ; strip leading plus sign same => n, Verbose( callerid 0:1 is ${CALLERID(num):0:1} ) same => n,ExecIf($["${CALLERID(num):0:1}" = "+"]?Set(CALLERID(num) = ${CALLERID(num):1}) same=>n,GotoIf(${BLACKLIST()}?make-em-wait) but it's stripping the first character + sign or not. The callerid is 1203XX -- Executing [s@hangup-spam:3] Verbose("PJSIP/2667075-000b", " callerid 0:1 is 1 ") in new stack callerid 0:1 is 1 -- Executing [s@hangup-spam:4] ExecIf("PJSIP/2667075-000b", "0?Set(CALLERID(num) = 203XXX") in new stack -- Executing [s@hangup-spam:5] GotoIf("PJSIP/2667075-000b", "0?make-em-wait") in new stack ExecIf correctly finds the comparison false(the "0"), but still executes the appiftrue . What am I missing ? Try ExecIf($["x${CALLERID(num):0:1}" == "x+"]?Set(CALLERID(num) = ${CALLERID(num):1}) Or you could use somethjing like exten = _X.,1,NoOp(Your dialplan) same = n,... exten = _+.,1,Goto(${EXTEN:1},1) I like using the "x" before caller id. That deals with caller id null values. I also agree that the Set equal sign should not have spaces on either side. But, the problem here was : no closing parens for the ExecIf ! Thanks for the help. I figured this out because I kept changing the line based on your suggestions. sean -- _ -- Bandwidth and Colocation Provided by http://www.api-digital.com -- Check out the new Asterisk community forum at: https://community.asterisk.org/ New to Asterisk? Start here: https://wiki.asterisk.org/wiki/display/AST/Getting+Started asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users