How Does Linphone Toggle SIP Contact?

来源:互联网 发布:mysql删除自增长 编辑:程序博客网 时间:2024/06/05 08:45
  1. Linphone client monitors the user’s contact info, if changed use LibLinphone to synchronize the contact.
  2. How synchronize?
    1. Linphone use a struct named LinphonePorxy to manager the settings of Linphone, all changed contact info should should save to Linphone Core Store via it.
    2. In order to toggle the contact, firstly validate new contact info. Only all details are correct, it will turn to next, otherwise do alert that “Toggle Contact Failed!”
    3. If all the new contact info has passed the checks, Liblinphone can use its methods to Unregister the old contact and then REGISTER new contact.
      1. In the codes, just use both methods linphone_proxy_config_edit(cfg); and linphone_proxy_config_done(cfg); to stop a struct named Refresher, then the refresher can automatically send a SIP REGISTER message with “Expires: 0” to OpenSIPS. Although SIP server will send a “401 Unauthorized” message, linphone will discard the stateless response [401]
      2. Then, use linphone_core_add_proxy_config(lc, proxycfg) to set a new proxy to “Linphone Core”. In this method, it will send a new REGISTER message with new contact info and “Expires: 3600” to register the newly contact.
0 0