X-Git-Url: http://git.eversberg.eu/gitweb.cgi?p=lcr.git;a=blobdiff_plain;f=sip.cpp;h=6dbb4b35a89e684b507ce4ab7184c3016f36097d;hp=a678449a8d4046f5f4a366d21f18536ee877ac19;hb=034d3a91404addedc1c7a3494862c79532b0b878;hpb=1fd1d5d17c82f7f77530ceea14e4138ee46e77e9 diff --git a/sip.cpp b/sip.cpp index a678449..6dbb4b3 100644 --- a/sip.cpp +++ b/sip.cpp @@ -280,6 +280,8 @@ we only support alaw and ulaw! } while(n--) *to++ = flip[*from++]; + if (psip->p_dov_rx) + psip->dov_rx(payload, payload_len); psip->bridge_tx(payload, payload_len); return 0; @@ -597,10 +599,18 @@ we only support alaw and ulaw! /* receive from remote */ int Psip::bridge_rx(unsigned char *data, int len) { + int ret; + /* don't bridge, if tones are provided */ - if (p_tone_name[0]) + if (p_tone_name[0] || p_dov_tx) return -EBUSY; + if (p_dov_tx) + return -EBUSY; + + if ((ret = Port::bridge_rx(data, len))) + return ret; + /* write to rx buffer */ while(len--) { p_s_rxdata[p_s_rxpos++] = flip[*data++]; @@ -1314,7 +1324,8 @@ int Psip::parse_sdp(sip_t const *sip, unsigned int *ip, unsigned short *port, ui void Psip::i_invite(int status, char const *phrase, nua_t *nua, nua_magic_t *magic, nua_handle_t *nh, nua_hmagic_t *hmagic, sip_t const *sip, tagi_t tagss[]) { struct sip_inst *inst = (struct sip_inst *) p_s_sip_inst; - const char *from = "", *to = ""; + const char *from = "", *to = "", *name = ""; + char imsi[16] = ""; int ret; class Endpoint *epoint; struct lcr_msg *message; @@ -1330,10 +1341,22 @@ void Psip::i_invite(int status, char const *phrase, nua_t *nua, nua_magic_t *mag return; } - if (sip->sip_from && sip->sip_from->a_url) - from = sip->sip_from->a_url->url_user; - if (sip->sip_to && sip->sip_to->a_url) - to = sip->sip_to->a_url->url_user; + if (sip->sip_from) { + if (sip->sip_from->a_url) + from = sip->sip_from->a_url->url_user; + if (sip->sip_from->a_display) { + name = sip->sip_from->a_display; + if (!strncmp(name, "\"IMSI", 5)) { + strncpy(imsi, name + 5, 15); + imsi[15] = '\0'; + name = ""; + } + } + } + if (sip->sip_to) { + if (sip->sip_to->a_url) + to = sip->sip_to->a_url->url_user; + } PDEBUG(DEBUG_SIP, "invite received (%s->%s)\n", from, to); sip_trace_header(this, "Payload received", DIRECTION_NONE); @@ -1408,6 +1431,12 @@ void Psip::i_invite(int status, char const *phrase, nua_t *nua, nua_magic_t *mag p_callerinfo.ntype = INFO_NTYPE_UNKNOWN; SCPY(p_callerinfo.id, from); add_trace("calling", "number", "%s", from); + SCPY(p_callerinfo.name, name); + if (name[0]) + add_trace("calling", "name", "%s", name); + SCPY(p_callerinfo.imsi, imsi); + if (imsi[0]) + add_trace("calling", "imsi", "%s", imsi); } SCPY(p_callerinfo.interface, inst->interface_name); /* dialing information */ @@ -2021,7 +2050,7 @@ void Psip::update_load(void) return; /* don't start timer if ... */ - if (!p_tone_name[0]) + if (!p_tone_name[0] && !p_dov_tx) return; p_s_next_tv_sec = 0; @@ -2033,7 +2062,7 @@ static int load_timer(struct lcr_timer *timer, void *instance, int index) class Psip *psip = (class Psip *)instance; /* stop timer if ... */ - if (!psip->p_tone_name[0]) + if (!psip->p_tone_name[0] && !psip->p_dov_tx) return 0; psip->load_tx(); @@ -2087,6 +2116,9 @@ void Psip::load_tx(void) /* copy tones */ if (p_tone_name[0]) { tosend -= read_audio(p, tosend); + } else + if (p_dov_tx) { + tosend -= dov_tx(p, tosend); } if (tosend) { PERROR("buffer is not completely filled\n");