July 11, 2008

optional SMS parameters

there were a few threads in the support forums over the last few days about figuring out how to send vendor specific optional parameters via coldfusion's oh-so-sweet SMS gateway. i'd never had to do this before (mainly because we'd managed to avoid SMS vendors who required them) and after pouring thru the docs it looked like the coldfusion team might have missed this. no biggie, i've used the logica java lib that powers the SMS gateway before (to debug some soggy SMS vendors) so i passed along some old coldfusion code.

to be thorough though i got in touch w/the head SMS honcho tom jordahl just in case and lo & behold the coldfusion team actually did think of everything--it just slipped through the usually stellar cf docs.

so to add any optional parameters to your outgoing SMS you just need to do something like:

params=StructNew();
params["0x1501"]=BinaryDecode("1a2b3c4d","hex");
params["0x1522"]=CharsetDecode("my value","utf-8");
outgoingSMS.optionalParameters=params;


where the "0x1501", etc business are vendor specific optional parameters. which is SO much simpler than the gobs (and gobs) of cf/java code in my approach.

note the use of the charset/BinaryDecode functions. the values for optionalParameters have to be byte[], which those functions return.

btw you could also use the following if you need to send along just the one parameter:

out.optionalParameter=0x1500;
out.optionalParameterValue="1,2,3,4";


note that's optionalParameter without the "s".

so yeah, they really do make the hard things easy :-)

Labels:

0 Comments:

Post a Comment

<< Home