funbox/smppex

Handling of special characters (hyphen, underscore) - source_addr_ton

Closed this issue · 0 comments

Hi, I run into an issue where SMSC was returning status code 72 indicating that the source address ton was invalid, in this case it was being set to 0.
I realized that because the source address contains a hyphen e.g Test-SM, the TONNPIDefaults was setting the address type/npi to 0 since the regex checks only a number and alphanumeric.
Changing the alphanumeric class to graph solves the issue. I'm not convince it's the right solution since it opens up the possibility of passing special characters as the source address. I've seen hyphen and an underscored being used mostly in the source address, the other solution was to check if the ton and npi was set to 0, then for the presence of an underscore or hyphen, set the ton to 5/alphanumeric.

What do you think, is there a better approach?