Handling backslash (\) in callerid(name)

For some reason all T-Mobile cell phones that dial into my PRI are giving the callerid(name) as “DOE JOHN” which will cause an error and Asterisk immediately hangs up the call.

[code]Nov 3 11:15:18 VERBOSE [20973] pbx.c:
– Executing [s@app-blacklist-check:3] Return(“DAHDI/i1/3305559190-5”, “”) in new stack

[Nov 3 11:15:18] WARNING[20973] ast_expr2.fl: ast_yyerror(): syntax error: syntax error, unexpected ‘’, expecting $end; Input:
“DOE JOHN” " = “”
^
[Nov 3 11:15:18] WARNING[20973] ast_expr2.fl: If you have questions, please refer to https://wiki.asterisk.org/wiki/display/AST/Channel+Variables
Nov 3 11:15:18 VERBOSE [20973] pbx.c:
– Executing [7770@from-pstn:3] ExecIf(“DAHDI/i1/3305559190-5”, ““DOE JOHN” ?Set(CALLERID(name)=3305559190)”) in new stack
Nov 3 11:15:18 ERROR [20973] app_exec.c:
Usage: ExecIf(?()[:(<args)])
Nov 3 11:15:18 VERBOSE [20973] pbx.c:
== Spawn extension (from-pstn, 7770, 3) exited non-zero on 'DAHDI/i1/3305559190-5’
Nov 3 11:15:18 VERBOSE [20973] pbx.c:
– Executing [h@from-pstn:1] Macro(“DAHDI/i1/3305559190-5”, “hangupcall,”) in new stack[/code]

I’ve changed extensions_custom.conf to:

That gets me working but now I don’t have any CID name anymore. Would love for a way to be able to handle the backslash so I can retain the name and not hangup the call.

Also I’m using Elastix and here are all the version numbers

[code]Kernel
Linux(i386)-2.6.18-238.12.1.el5

Elastix
package-elastix-is
elastix-asterisk-sounds-1.2.3-1
elastix-my_extension-2.2.0-6
elastix-im-2.2.0-2
elastix-firstboot-2.3.0-7
elastix-system-2.3.0-12
elastix-agenda-2.3.0-7
elastix-framework-2.3.0-11
elastix-fax-2.3.0-4
elastix-pbx-2.3.0-14
elastix-a2billing-1.9.4-5
elastix-addons-2.3.0-6
elastix-vtigercrm-5.2.1-6
elastix-email_admin-2.3.0-6
elastix-extras-2.2.0-1
elastix-security-2.3.0-5
elastix-reports-2.3.0-4

RounCubeMail
RoundCubeMail-0.3.1-11

Mail
postfix-2.3.3-2.3.el5_6
cyrus-imapd-2.3.7-12.el5_7.2

IM
openfire-3.7.1-1

FreePBX
freePBX-2.8.1-14

Asterisk
asterisk-1.8.17.0-0
asterisk-perl-0.10-2
asterisk-addons-1.8.17.0-0

FAX
hylafax-4.3.10-2rhel5
iaxmodem-1.2.0-1.1

DRIVERS
dahdi-2.6.1-4
rhino-0.99.4-2.rc1
wanpipe-util-3.5.28-0[/code]

I can’t remember if variable sub-stringing allows lengths relative to the total length, but if it does, you could sub-string so as to remove the last character.

If you could point me towards that documentation I can experiment. Seems like there should be a way to escape characters in a variable. I’m not very familiar with Asterisk, just know features like this exist in most programming languages and I use it quite often in PHP.

I’ve read that the backslash is not a legal character in callerid, however I can’t control the information I’m passed so it would be nice to be able to handle bad characters rather than hanging up the call.

doc/tex/channelvariables.tex

There is probably a bug here, but the protection of meta characters is rather limited.

You should also see if any of the applications or functions will take the variable as an l-value and return a cleaned up version (core show applications and core show functions).

David sorry for being a total n00b but can you tell me more about l-values and core show applications and core show functions?

Also should I be filling out a bug report for this as I would think this isn’t proper handling of the backslash. I’m reading the documentation on variables and I’ll post back if I get anywhere with that.

This is a hack that works, essentially eliminating last 2 characters since is a backslash then a space that I have to get rid of

Other thing that works that I don’t quite understand is that I can use

And the call will ring through and still display the callerid name properly on the phone. Not sure how that is possible.

en.wikipedia.org/wiki/Value_(computer_science

[quote]
Asterisk Ready.
*CLI> help core show applications
Usage: core show applications [{like|describing} ]
List applications which are currently available.
If ‘like’, will be a substring of the app name
If ‘describing’, will be a substring of the description
*CLI> help core show functions
Usage: core show functions [like ]
List builtin functions, optionally only those matching a given string[/quote]