How to fetch Outgoing message ID

How to fetch Outgoing message ID SearchSearch
Author Message
jerrel
New member
Username: Jerrel

Post Number: 11
Registered: 02-2004
Posted on Friday, March 17, 2006 - 07:12 pm:   

Dear Bryce,
I read almost the whole forum reagarding delivery reports and messages ID, but still i have not found my answer.
I figured out that the @@RECEIPTMESSAGEID@@ fetches the message id from the delivery report, but how do I fetch the message id from the outgoing message ?? The @@messageid@@ gives me a different message id.
I use the 5.51k version of nowsms.

Best regards

Jerrel
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 5688
Registered: 10-2002
Posted on Tuesday, March 21, 2006 - 05:57 pm:   

Hi Jerrel,

Are you submitting the message via HTTP?

If so, you need to parse the HTTP response that comes back when you submit the message. You need to look for the string "MessageID=", and parse up to a "," (or any other white space).

That ID is the message id assigned by NowSMS ... not the upstream SMSC. In v5.51k, NowSMS, when it receives an SMPP delivery receipt will translate the message id in the receipt back to the original NowSMS assigned message id, as long as TrackSMPPReceipts=Yes is set under the [SMSGW] section of SMSGW.INI. (This setting is not necessary undre NowSMS 2006 as it is enabled by default.)

-bn
jerrel
New member
Username: Jerrel

Post Number: 12
Registered: 02-2004
Posted on Wednesday, March 22, 2006 - 01:46 pm:   

Dear Bryce,
I read about parsing the http responce, but have no idea how to do that.
I submit my messages using a php script, and the only way I know how to fetch information from nowsms is through the @@ parameters.
Do you have an example of how to fetch teh http responce from nowsms ?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 5697
Registered: 10-2002
Posted on Wednesday, March 22, 2006 - 08:07 pm:   

Hi Jerrel,

How good are you at PHP (I'm not very experienced with it).

If you're using an interface like the sendsms.php script at http://support.nowsms.com/discus/messages/1/867.html, then basically what you need to do is a string search on the response that comes back from the HTTP request.

In that script, the "$res" variable contains the HTTP response.

You would do a string search of the contents of that variable to locate the text string "MessageID=". Then copy the text that follows this (up to a line break or ",") to get the message id.

I'm not an expert at PHP, but you'd probably use the stristr function to locate "MessageID=", and then jump ahead past the "MessageID=" text to locate the string.

I'm not sure exactly how to do this type of string manipulation in PHP ... maybe this gives you some idea though?

-bn
jerrel
New member
Username: Jerrel

Post Number: 13
Registered: 02-2004
Posted on Monday, March 27, 2006 - 07:19 pm:   

Dear Bryce,

I'm not an expert in PHP, but with some guidens, i can manage.
I checked out the script you refert to, but I send my SMS (binary) with the redirect (header) method.
But any way here is what i did to try fetching the message id.

$fp = fsockopen("192.168.10.3", 8800, $errno, $errstr);
if (!$fp) {
return $result;
}
fwrite($fp, " HTTP/1.1\r\n");


fwrite($fp, "\n");
Header("Location: http://192.168.10.3:8800/?PhoneNumber=%2b5978560999&Text=test.\n\n");
print $_ENV['SERVER_PROTOCOL']." 200 OK\n";



$res = "";

while(!feof($fp))
{
$res .= fread($fp,128);
}
fclose($fp);

$res=addslashes($res);
mysql_query ("INSERT INTO dlr (sndmsgid) VALUES ('$res')");

At the end i store the $res value in a database, but the messageid is nowhere to be found.

Any idea how to solve this ?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 5750
Registered: 10-2002
Posted on Wednesday, March 29, 2006 - 08:18 pm:   

Hi Jerrel,

If you use the redirect method, then you won't see the response, because your script terminates before the actual message submission request occurs.

You'd want to use something more like the script that I referenced. Just modify the URL parameters to send the type of message that you need to send. The example is just passing a "Phone" and "Text" parameter, but you could easily add other variables.

-bn

alya
New member
Username: Alya

Post Number: 8
Registered: 12-2003
Posted on Thursday, June 08, 2006 - 03:33 am:   

Hi...Bryce
as i know @@messageid@@ is generated by nowsms.


Sometime we need use our user define messageid, its depend on operator needed.

can we override this with our user define message id?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6060
Registered: 10-2002
Posted on Friday, June 16, 2006 - 09:54 pm:   

Hi,

Are you using an HTTP or SMPP connection to the operator?

For HTTP, there is an "ExtraHttpArgList" setting that provides some flexibility. For more information see the description of this setting in the following link: http://support.nowsms.com/discus/messages/1/5972.html


For SMPP, there is support for optional TLV parameters that are used by some SMPP implementations. For more information, see the description of the "SMPPOptions" section of SMSGW.INI at the following link: http://support.nowsms.com/discus/messages/1/5972.html

-bn
alya
New member
Username: Alya

Post Number: 9
Registered: 12-2003
Posted on Saturday, June 17, 2006 - 07:38 am:   

hi,
in this situation do mean @@messageid@@ is user_message_reference ?
in sample :
[SMPP - ip.address:port] DefaultSMPPOptions=mblox_tariff=00000;user_message_reference=1

----
how to make the value to be dinamicly?
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6077
Registered: 10-2002
Posted on Monday, June 19, 2006 - 10:21 pm:   

No.

I'm sorry, but I'm confused about what you are asking.

Let me explain some of my confusion, so that maybe you can better explain what you are trying to do, and I can suggest a way to accomplish it.

@@MESSAGEID@@ is a replacement parameter that might be used in a 2-way SMS script.

It is also a recently added parameter that can be passed to an HTTP SMSC for somewhat specialised purposes.

I think it would help if you could provide more detail about what you are trying to do.
alya
New member
Username: Alya

Post Number: 11
Registered: 12-2003
Posted on Tuesday, June 20, 2006 - 05:24 am:   

Oops...sorry make u confused,
In smpp connection :
each sms i submit i will generated my-sms-id. let say the number will combination of msisdn and charging. so the my-sms-id example : 31900717+2000 or "319007172000"
my question :
1. except : phonenumber, text,etc. is it possible to submit "my-sms-id" to smsc?
2. if "Yes", it's should be via TLV? what should i use ? receipted_message_id (1E) or message_reference (204) ?.
thank you and i hope it not make u confused again. sorry for my poor english.

-alya aisha-
Bryce Norwood - NowSMS Support
Board Administrator
Username: Bryce

Post Number: 6095
Registered: 10-2002
Posted on Tuesday, June 20, 2006 - 04:58 pm:   

Hi Alya,

It depends on your SMS service provider.

What would be most typical would be to use the "user_message_reference" parameter.

But different SMS service providers use different techniques. Some have defined their own TLV parameters that are specific to their service.

-bn