Антон Загорский wrote:
Hello!

I'm trying to implement a PUBLISH request in the voicemail app for using MWI
feature.
So, I'm writing some code in the AnswerMachine.cpp in the void
AnswerMachineDialog::onBye, but I'm a bit confused about AmSipRequest
fields.

unsigned int serKeyLen = 0;
AmSipRequest publish_request;

publish_request.method = "PUBLISH";
publish_request.hdrs = "Max-Forwards: 32";
publish_request.to = "[email protected]"; // subscriber
publish_request.from = "[email protected]";
publish_request.from_uri = "[email protected]";
publish_request.next_hop = "sip:192.168.0.1:5060"; // opensips
publish_request.callid = "123456780";
DBG("*** Sending request...\n");
AmServer::sendRequest(publish_request, NULL, serKeyLen);
DBG("*** Finished\n");


And I've got in log
onBye (AnswerMachine.cpp:916): *** Sending request...
DEBUG: [b71a9b90] parse_headers (parse_header.cpp:403): Incomplete header
(st=0;saved_st=0)
DEBUG: [b71a9b90] parse_headers (parse_header.cpp:405): header =
"[email protected]"
ERROR: [b71a9b90] send (SipCtrlInterface.cpp:236): Malformed To or From
header
DEBUG: [b71a9b90] ~sip_msg (sip_parser.cpp:92): ~sip_msg()
DEBUG: [b71a9b90] onBye (AnswerMachine.cpp:918): *** Finished
you're missing "sip:" ("sip:[email protected]").



Could you please explain how will exactly AmSipRequest should be filled? And
what are parameters serKey and serKeyLen in the AmServer::sendRequest?
that is only up to 1.2, you could consider switching to newer sems code. serKey was the transaction key used by the sip stack, its a char array you pass to sendRequest; you'll get back the length in serKeyLen.

hth
Stefan




Also, a note about core/sipctrl/sip_parser.cpp:int parse_sip_msg()
There are a lot of assignment like err_msg = (char *)"blablabla" where
err_msg is a function parameter char *&.
But that will assignment to err_msg a local pointer and outside of
parse_sip_msg() this pointer will be invalid.
Right decisions are:
1) use string (safe, a bit slowly)
2) use strcpy_s (unsafe, fast)


[email protected]
www.oyster-telecom.ru



_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems



--
Stefan Sayer
VoIP Services Consulting and Development

Warschauer Str. 24
10243 Berlin

tel:+491621366449
sip:[email protected]
email/xmpp:[email protected]


_______________________________________________
Sems mailing list
[email protected]
http://lists.iptel.org/mailman/listinfo/sems

Reply via email to