static void presence_refresher_listener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase){ SalOp* op = (SalOp*)user_pointer; switch(status_code){ case 481: { ms_message("The server or remote ua lost the SUBSCRIBE dialog context. Let's restart a new one."); belle_sip_refresher_stop(op->refresher); if (op->dialog) { /*delete previous dialog if any*/ belle_sip_dialog_set_application_data(op->dialog,NULL); belle_sip_object_unref(op->dialog); op->dialog=NULL; } if (sal_op_get_contact_address(op)) { /*contact is also probably not good*/ SalAddress* contact=sal_address_clone(sal_op_get_contact_address(op)); sal_address_set_port(contact,-1); sal_address_set_domain(contact,NULL); sal_op_set_contact_address(op,contact); sal_address_destroy(contact); } sal_subscribe_presence(op,NULL,NULL,-1); break; } } }
/** * Sets the port number. **/ void linphone_address_set_port(LinphoneAddress *uri, int port){ #ifdef USE_BELLESIP sal_address_set_port(uri,port); #else sal_address_set_port_int(uri,port); #endif }
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_tunneled) { SalAddress* sal_addr = sal_address_new(NULL); int result; sal_address_set_domain(sal_addr,addr); sal_address_set_port(sal_addr,port); sal_address_set_transport(sal_addr,tr); result = sal_add_listen_port(ctx, sal_addr, is_tunneled); sal_address_destroy(sal_addr); return result; }
static void presence_refresher_listener(belle_sip_refresher_t* refresher, void* user_pointer, unsigned int status_code, const char* reason_phrase){ SalOp* op = (SalOp*)user_pointer; if (status_code >= 300) { ms_message("The SUBSCRIBE dialog no longer works. Let's restart a new one."); belle_sip_refresher_stop(op->refresher); if (op->dialog) { /*delete previous dialog if any*/ set_or_update_dialog(op, NULL); } if (sal_op_get_contact_address(op)) { /*contact is also probably not good*/ SalAddress* contact=sal_address_clone(sal_op_get_contact_address(op)); sal_address_set_port(contact,-1); sal_address_set_domain(contact,NULL); sal_op_set_contact_address(op,contact); sal_address_destroy(contact); } /*send a new SUBSCRIBE, that will attempt to establish a new dialog*/ sal_subscribe_presence(op,NULL,NULL,-1); } }
/** * Sets the port number. **/ void linphone_address_set_port(LinphoneAddress *uri, const char *port){ sal_address_set_port(uri,port); }
/** * Sets the port number. **/ void linphone_address_set_port(LinphoneAddress *uri, int port){ sal_address_set_port(uri,port); }