int eXosip_options_build_request (osip_message_t ** options, const char *to, const char *from, const char *route) { int i; *options = NULL; if (to != NULL && *to == '\0') return -1; if (from != NULL && *from == '\0') return -1; if (route != NULL && *route == '\0') route = NULL; i = generating_request_out_of_dialog (options, "OPTIONS", to, "UDP", from, route); if (i != 0) return -1; /* after this delay, we should send a CANCEL */ osip_message_set_expires (*options, "120"); /* osip_message_set_organization(*invite, "Jack's Org"); */ return 0; }
/* this method can't be called unless the previous INVITE transaction is over. */ int eXosip_call_build_initial_invite (osip_message_t ** invite, const char *to, const char *from, const char *route, const char *subject) { int i; osip_to_t *_to = NULL; *invite = NULL; if (to != NULL && *to == '\0') return OSIP_BADPARAMETER; if (route != NULL && *route == '\0') route = NULL; if (subject != NULL && *subject == '\0') subject = NULL; i = osip_to_init (&_to); if (i != 0) return i; i = osip_to_parse (_to, to); if (i != 0) { osip_to_free (_to); return i; } i = generating_request_out_of_dialog (invite, "INVITE", to, eXosip.transport, from, route); osip_to_free (_to); if (i != 0) return i; _eXosip_dialog_add_contact (*invite, NULL); if (subject != NULL) osip_message_set_subject (*invite, subject); /* after this delay, we should send a CANCEL */ osip_message_set_expires (*invite, "120"); return OSIP_SUCCESS; }
int generating_publish (osip_message_t ** message, const char *to, const char *from, const char *route) { int i; if (to != NULL && *to == '\0') return OSIP_BADPARAMETER; if (route != NULL && *route == '\0') route = NULL; i = generating_request_out_of_dialog (message, "PUBLISH", to, "UDP", from, route); if (i != 0) return i; /* osip_message_set_organization(*message, "Jack's Org"); */ return OSIP_SUCCESS; }
int eXosip_message_build_request (osip_message_t ** message, const char *method, const char *to, const char *from, const char *route) { int i; *message = NULL; if (method != NULL && *method == '\0') return -1; if (to != NULL && *to == '\0') return -1; if (from != NULL && *from == '\0') return -1; if (route != NULL && *route == '\0') route = NULL; i = generating_request_out_of_dialog (message, method, to, "UDP", from, route); if (i != 0) return -1; return 0; }
int generating_register (eXosip_reg_t * jreg, osip_message_t ** reg, char *transport, char *from, char *proxy, char *contact, int expires) { int i; char locip[65]; char firewall_ip[65]; char firewall_port[10]; if (eXosip.eXtl == NULL) return OSIP_NO_NETWORK; if (eXosip.eXtl->tl_get_masquerade_contact != NULL) { eXosip.eXtl->tl_get_masquerade_contact (firewall_ip, sizeof (firewall_ip), firewall_port, sizeof (firewall_port)); } i = generating_request_out_of_dialog (reg, "REGISTER", NULL, transport, from, proxy); if (i != 0) return i; memset (locip, '\0', sizeof (locip)); eXosip_guess_ip_for_via (eXosip.eXtl->proto_family, locip, 49); if (locip[0] == '\0') { OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_ERROR, NULL, "eXosip: no default interface defined\n")); osip_message_free (*reg); *reg = NULL; return OSIP_NO_NETWORK; } if (contact == NULL) { osip_contact_t *new_contact = NULL; osip_uri_t *new_contact_url = NULL; i = osip_contact_init (&new_contact); if (i == 0) i = osip_uri_init (&new_contact_url); new_contact->url = new_contact_url; if (i == 0 && (*reg)->from != NULL && (*reg)->from->url != NULL && (*reg)->from->url->username != NULL) { new_contact_url->username = osip_strdup ((*reg)->from->url->username); } if (i == 0 && (*reg)->from != NULL && (*reg)->from->url != NULL) { /* serach for correct ip */ if (firewall_ip[0] != '\0') { char *c_address = (*reg)->req_uri->host; struct addrinfo *addrinfo; struct __eXosip_sockaddr addr; i = eXosip_get_addrinfo (&addrinfo, (*reg)->req_uri->host, 5060, IPPROTO_UDP); if (i == 0) { memcpy (&addr, addrinfo->ai_addr, addrinfo->ai_addrlen); eXosip_freeaddrinfo (addrinfo); c_address = inet_ntoa (((struct sockaddr_in *) &addr)->sin_addr); OSIP_TRACE (osip_trace (__FILE__, __LINE__, OSIP_INFO1, NULL, "eXosip: here is the resolved destination host=%s\n", c_address)); } if (eXosip_is_public_address (c_address)) { new_contact_url->host = osip_strdup (firewall_ip); new_contact_url->port = osip_strdup (firewall_port); } else { new_contact_url->host = osip_strdup (locip); new_contact_url->port = osip_strdup (firewall_port); } } else { new_contact_url->host = osip_strdup (locip); new_contact_url->port = osip_strdup (firewall_port); } if (transport != NULL && osip_strcasecmp (transport, "UDP") != 0) { osip_uri_uparam_add (new_contact_url, osip_strdup ("transport"), osip_strdup (transport)); } if (jreg->r_line[0] != '\0') { osip_uri_uparam_add (new_contact_url, osip_strdup ("line"), osip_strdup (jreg->r_line)); } osip_list_add (&(*reg)->contacts, new_contact, -1); } } else { osip_message_set_contact (*reg, contact); } { char exp[10]; /* MUST never be ouside 1 and 3600 */ snprintf (exp, 9, "%i", expires); osip_message_set_expires (*reg, exp); } osip_message_set_content_length (*reg, "0"); return OSIP_SUCCESS; }
#ifndef MINISIZE #include "eXosip2.h" #include <eXosip2/eXosip.h> int eXosip_refer_build_request(osip_message_t ** refer, const char *refer_to, const char *from, const char *to, const char *proxy MARGS) { int i; *refer = NULL; i = generating_request_out_of_dialog(refer, "REFER", to, "UDP", from, proxy MPARAMS); if (i != 0) { return i; } osip_message_set_header(*refer, "Refer-to", refer_to); return OSIP_SUCCESS; } int eXosip_refer_send_request(osip_message_t * refer MARGS) { osip_transaction_t *transaction; osip_event_t *sipevent; int i; if (refer == NULL)