/** * owplLineAdd * * add a virtual line * * @param displayname * @param username * @param server * @param proxy * @param regTimeout The value that will be put in Expire header of register message * @param(out) phLine The newly created line handle * @return OWPL_RESULT_SUCCESS in case of success */ MY_DLLEXPORT OWPL_RESULT owplLineAdd(const char* displayname, const char* username, const char* server, const char* proxy, int regTimeout, OWPL_LINE * phLine) { int ret; phVLine *vl; vl = ph_find_matching_vline2(username, server, 0); if (vl) { vl->regTimeout = regTimeout; *phLine = ph_vline2vlid(vl); } else { /* Call phAddVline2 with timeout = 0 to avoid sending right away the REGISTER message. * (this function send a REGISTER message if timeout > 0 and we have shouldn't change it * for backward compatibility */ ret = phAddVline2(displayname, username, server, proxy, 0); if (ret < 0) { return OWPL_RESULT_FAILURE; } vl = ph_vlid2vline(ret); if (vl) { vl->regTimeout = regTimeout; } *phLine = ret; } return OWPL_RESULT_SUCCESS; }
phVLine * ph_find_matching_vline(const char *userid, int ignore) { osip_from_t *from; phVLine *vl; char *host; char hostport[256]; char *uname; hostport[0] = 0; from = ph_parse_from(userid); if (!from) return 0; if (from->url) uname = from->url->username; else uname = hostport; if (!(ignore & PHM_IGNORE_PORT) && from->url && from->url->port) { snprintf(hostport, sizeof(hostport), "%s:%s", from->url->host, from->url->port); host = hostport; } else if (ignore & PHM_IGNORE_HOST) host = 0; else if (from->url) { host = from->url->host; } else host = hostport; vl = ph_find_matching_vline2(uname, host, ignore); osip_from_free(from); return vl; }
/** * owplLineAdd * * add a virtual line * * @param displayname * @param username * @param server * @param proxy * @param regTimeout The value that will be put in Expire header of register message * @param(out) phLine The newly created line handle * @return OWPL_RESULT_SUCCESS in case of success */ OWPL_RESULT owplLineAdd(const char * displayname, const char * sipUsername, const char * sipServer, const char * sipProxy, OWPL_TRANSPORT_PROTOCOL sipTransport, int regTimeout, OWPL_LINE * phLine) { int ret; phVLine *vl; vl = ph_find_matching_vline2(sipUsername, sipServer, 0); if (vl) { vl->regTimeout = regTimeout; *phLine = ph_vline2vlid(vl); } else { /* Call phAddVline2 with timeout = 0 to avoid sending right away the REGISTER message. * (this function send a REGISTER message if timeout > 0 and we have shouldn't change it * for backward compatibility */ ret = phAddVline2(displayname, sipUsername, sipServer, sipProxy, sipTransport, 0); if (ret < 0) { return OWPL_RESULT_FAILURE; } vl = ph_vlid2vline(ret); if (vl) { vl->regTimeout = regTimeout; } *phLine = ret; owplLineSetAutoKeepAlive(ret, 1, 30); } return OWPL_RESULT_SUCCESS; }