Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/227.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何使用pjsua2 android发送带有自定义头的SIP消息_Android_Pjsip - Fatal编程技术网

如何使用pjsua2 android发送带有自定义头的SIP消息

如何使用pjsua2 android发送带有自定义头的SIP消息,android,pjsip,Android,Pjsip,关于那件事 我已成功发送消息,但我想发送自定义标头,因为获取特定消息已发送给更新用户的状态 public void sendInstantMessage(String number, String msgBody) { String sipServer = "aaa.ggg.net"; String buddy_uri = "<sip:" + number + "@" + sipServer + ">"; BuddyConfig bCfg = new BuddyConfig();

关于那件事

我已成功发送消息,但我想发送自定义标头,因为获取特定消息已发送给更新用户的状态

public void sendInstantMessage(String number, String msgBody) {
String sipServer = "aaa.ggg.net";
String buddy_uri = "<sip:" + number + "@" + sipServer + ">";

BuddyConfig bCfg = new BuddyConfig();
bCfg.setUri(buddy_uri);
bCfg.setSubscribe(false);

MyBuddy myBuddy = new MyBuddy(bCfg);
SendInstantMessageParam prm = new SendInstantMessageParam();
prm.setContent(msgBody);
}

通过为链接使用`Token pj::SendInstantMessageParam::userData

我想发送userdata头,但如何发送该头


谢谢

我终于找到了使用pjsip-2.4发送带有自定义标题的短信的解决方案

这是密码

String msgBody = "sending message";
    SendInstantMessageParam prm = new SendInstantMessageParam();
 prm.setContent(msgBody);
 SipHeader hName = new SipHeader();
 hName.setHName("name");
 hName.setHValue(uniqueId);

 SipHeaderVector headerVector = new SipHeaderVector();
 headerVector.add(hName);
 SipTxOption option = new SipTxOption();
 option.setHeaders(headerVector);
 prm.setTxOption(option);
 try {

  myBuddy.sendInstantMessage(prm);
 } catch (Exception e) {
  e.printStackTrace();
 }
String msgBody = "sending message";
    SendInstantMessageParam prm = new SendInstantMessageParam();
 prm.setContent(msgBody);
 SipHeader hName = new SipHeader();
 hName.setHName("name");
 hName.setHValue(uniqueId);

 SipHeaderVector headerVector = new SipHeaderVector();
 headerVector.add(hName);
 SipTxOption option = new SipTxOption();
 option.setHeaders(headerVector);
 prm.setTxOption(option);
 try {

  myBuddy.sendInstantMessage(prm);
 } catch (Exception e) {
  e.printStackTrace();
 }