pjsip / pjproject

PJSIP project
http://www.pjsip.org
GNU General Public License v2.0
2.05k stars 778 forks source link

client how to send NOTIFY method to server? help me #2936

Closed nurnli closed 1 year ago

nurnli commented 2 years ago

NOTIFY sip:tyoung @parlour .elasticity.co.uk SIP / 2.0 Via SIP / 2.0 / UDP cartouche.rosettastone.org: 5060 ; branch = z9hG4bK3841323 Max - Forwards: 70 To : Thomas Young < sip:tyoung @elasticity .co.uk > ; tag = 1814 From : < sip:ptolemy @rosettastone .org > ; tag = 5363956k Call - ID: 452k59252058dkfj34924lk34 CSeq: 1 NOTIFY Contact: < sip:Ptolemy @cartouche .rosettastone.org > Content - Type: application / xml

give me a simple example please, thanks

amneiht commented 2 years ago

https://github.com/staskobzar/sip_stacks_examples may help you You can use dialog to send Notify the another way to send NOTIFY you can use pjsip_endpt_create_request and pjsip_endpt_send_request

pjsip_tx_data *tdata;
pjsip_endpt_create_request(endpt,&pjsip_options_method, &target, &user, &to, NULL,NULL, -1, NULL, &tdata);
pjsip_endpt_send_request(endpt, tdata, 20 * 1000, NULL,send_callback);

send_callback is callback funtion use to receive respone to server . Usually to use to generate authentication message to 401/407