[asterisk-users] Data transfer

thorsten.stoffregen at gmx.de thorsten.stoffregen at gmx.de
Thu Jan 28 06:04:05 CST 2010


> By the way, Asterisk writes the contents of the SIP message to the
> log, so at least there it is accessible. And since Asterisk is open source
> you can extend it as needed, I think there would be quite some interest
> here in slightly better testmessage features (ref. inbound SMS).

Ok I found a quick and dirty way to grab the messages. In chan_sip.c Asterisk 
drops the message:

ast_log(LOG_WARNING,"Received message to %s from %s, dropped it...\n  Content-Type:%s\n  Message: %s\n", get_header(req,"To"), get_header(req,"From"), content_type, buf);
transmit_response(p, "405 Method Not Allowed", req); /* Good enough, or? */

So I changed the response to:

transmit_response(p, "202 Accepted", req); 

and send the message to the AMI:

manager_event(EVENT_FLAG_CALL, "MessageReceived", "From: %s\r\nTo: %s\r\nContent-Type: %s\r\nMessage: %s\r\n", get_header(req,"From"), get_header(req,"To"), content_type, buf);

Its a quick way for me to get the messages, so I can go on and put a prototype together ;-)
And do some further testing....


Thorsten Stoffregen



More information about the asterisk-users mailing list