Changes in [36:12957c39df3b:37:4fe9562edc7c] in verona


Ignore:
Files:
2 deleted
4 edited

Legend:

Unmodified
Added
Removed
  • libosip2/src/osipparser2/osip_port.c

    r36 r37  
    2222#include <windows.h> 
    2323#endif 
     24 
    2425 
    2526 
  • phapi/phapi.c

    r19 r23  
    202202ph_build_cname(char *buf, int n, struct vline *vl); 
    203203 
    204 static const char  *ph_get_event_type_str(int winfo) 
     204static const char * 
     205ph_get_event_type_str(int winfo) 
    205206{ 
    206207  // FIXME: 
    207208  return winfo ? "presence.winfo" : "presence"; 
    208209}  
     210 
     211static int  
     212ph_req_set_body(osip_message_t *msg, const char *body, const char *mime); 
     213 
    209214 
    210215static  
     
    848853} 
    849854 
    850     
     855   
     856 
     857static int  
     858ph_req_set_body(osip_message_t *msg, const char *body, const char *mime) 
     859{ 
     860  char clen[10]; 
     861 
     862  snprintf(clen, 10, "%i", strlen(body)); 
     863  if (mime)  
     864    osip_message_set_content_type(msg, mime); 
     865  osip_message_set_body(msg, body, strlen(body)); 
     866  osip_message_set_content_length(msg, clen); 
     867 
     868  return 0; 
     869} 
     870  
    851871 
    852872int  
     
    920940     
    921941    eXosip_lock(); 
     942#ifdef NEWOSIP 
    922943    ret = eXosip_add_customization(reqnames, hdrname, hdrval); 
     944#endif 
    923945    eXosip_unlock(); 
    924946} 
     
    11701192 
    11711193 
     1194 
     1195 
     1196 
    11721197MY_DLLEXPORT int 
    11731198phLineSendMessage2(int vlid, const char *target, const char *uri,  
     
    11771202    struct vline *vl; 
    11781203    char from[512]; 
    1179      
     1204    osip_message_t *msg; 
     1205 
     1206 
    11801207    vl = ph_valid_vlid(vlid); 
    11811208    if (!vl) { 
     
    11921219     
    11931220    eXosip_lock(); 
    1194     i = eXosip_message2((char *) target, (char *)uri,  
    1195                         (char*)from, (char *)vl->proxy, (char*) buff,  
    1196                         (char *)mime, (char *)sipcid); 
     1221    i = eXosip_message_build_request(&msg, "MESSAGE", (char *)uri,  
     1222                        from, vl->proxy); 
     1223 
     1224 
     1225    ph_req_set_body(msg, buff, mime); 
     1226    osip_message_set_contact(msg, vl->contact); 
     1227 
     1228    if (sipcid) 
     1229      osip_message_set_call_id(msg, sipcid); 
     1230 
     1231    i = eXosip_message_send_request(msg); 
     1232 
    11971233    eXosip_unlock();   
    11981234    return i; 
     
    12041240    int i; 
    12051241    phcall_t *ca = ph_locate_call_by_cid(cid); 
     1242    osip_message_t *msg; 
    12061243 
    12071244    if (!ca) 
     
    12111248    eXosip_lock(); 
    12121249 
    1213     i = eXosip_message_call(ca->did, (char *)mime, (char *)buff); 
     1250    i = eXosip_call_build_request(ca->did, "MESSAGE", &msg); 
     1251    ph_req_set_body(msg, buff, mime); 
     1252    osip_message_set_contact(msg, ph_get_call_contact(ca)); 
     1253    i = eXosip_call_send_request(ca->did, msg); 
    12141254 
    12151255    eXosip_unlock();   
     
    12251265{ 
    12261266  int i; 
    1227  
    1228 if (!nonempty(from) || !nonempty(uri)) 
     1267  osip_message_t *msg; 
     1268 
     1269  if (!nonempty(from) || !nonempty(uri)) 
    12291270    return -PH_BADARG; 
    12301271 
    12311272  eXosip_lock(); 
    1232   i = eXosip_message((char *)uri, (char*) from, ph_get_proxy(from),  
    1233                                          buff, mime); 
     1273  i = eXosip_message_build_request(&msg, "MESSAGE", uri, from, ph_get_proxy(from)); 
     1274  ph_req_set_body(msg, buff, mime); 
     1275  i = eXosip_message_send_request(msg); 
    12341276  eXosip_unlock(); 
    12351277  return i; 
     
    13851427 
    13861428  eXosip_lock(); 
    1387   i = eXosip_publish_build_request(&msg, to, from, ph_get_proxy(from), ph_get_event_type_str(winfo), ph_get_expires_str(), content_type, content); 
     1429  i = eXosip_build_publish(&msg, to, from, ph_get_proxy(from), ph_get_event_type_str(winfo), ph_get_expires_str(), content_type, content); 
    13881430  if (!i) 
    13891431    i = eXosip_publish(msg, to); 
     
    14761518 
    14771519 
    1478 static int ph_answer_call(int tid, int status, const char *laport, const char *ctct,  
    1479                           const char *lvport, const char  *paport, const char *pvport,  
    1480                           const char *audioaddr, const char *videoaddr)  
    1481 { 
     1520static int  
     1521ph_answer_call(int tid, int status, const char *laport, const char *ctct,  
     1522               const char *lvport, const char  *paport, const char *pvport,  
     1523               const char *audioaddr, const char *videoaddr)  
     1524{ 
     1525  int i; 
     1526  osip_message_t *msg = 0; 
     1527 
     1528  i = eXosip_call_build_answer(tid, status, &msg); 
     1529  if (!i) { 
     1530#ifdef NEWOSIP 
     1531    char clen[10]; 
     1532    int sdplen; 
     1533 
     1534 
     1535    sdplen = strlen(sdpmesg); 
     1536    snprintf(clen,sizeof(clen),"%i",sdplen); 
     1537  
     1538    osip_message_set_body(msg,sdpmesg,sdplen); 
     1539    osip_message_set_content_type(msg,"application/sdp"); 
     1540    osip_message_set_content_length(sip,clen); 
     1541#endif 
     1542    if (ctct) 
     1543      osip_message_set_contact(msg, ctct); 
     1544 
     1545    i = eXosip_call_send_answer(tid, status, msg);   
     1546  } 
     1547   
     1548  return i; 
     1549 
    14821550}                         
    14831551 
     
    15171585    { 
    15181586        eXosip_lock(); 
    1519         i = ph_call_send_answer(ca->tid, 200, 0, 0, 0, 0, 0, 0, 0); 
     1587        i = ph_answer_call(ca->tid, 200, 0, 0, 0, 0, 0, 0, 0); 
    15201588    } 
    15211589    else 
     
    16061674   eXosip_lock(); 
    16071675    
    1608    i = eXosip_answer_call(ca->did, 200, local_voice_port, ph_get_call_contact(ca),  
     1676   i = ph_answer_call(ca->did, 200, local_voice_port, ph_get_call_contact(ca),  
    16091677                         NULL,NULL,NULL, 
    16101678                                 audioaddr, NULL); 
     
    16881756 
    16891757   eXosip_lock(); 
    1690    i = eXosip_answer_call(ca->did, 200, local_voice_port, ph_get_call_contact(ca),  
     1758   i = ph_answer_call(ca->did, 200, local_voice_port, ph_get_call_contact(ca),  
    16911759                         NULL,NULL,NULL, 
    16921760                                 ca->remote_sdp_audio_ip, NULL); 
     
    19972065   
    19982066int  
    1999 ph_answer_request(int did, int reason, char *ctct) 
     2067ph_answer_request(int tid, int reason, char *ctct) 
    20002068{ 
    20012069  int i; 
    20022070 
    20032071  eXosip_lock(); 
    2004   i = eXosip_answer_call(did, reason, 0, ctct, 0, 0, 0, 0, 0); 
     2072  i = ph_answer_call(tid, reason, 0, ctct, 0, 0, 0, 0, 0); 
    20052073  eXosip_unlock(); 
    20062074 
     
    20192087    return -PH_BADCID; 
    20202088 
    2021   i = ph_answer_request(ca->did, reason, ph_get_call_contact(ca)); 
     2089  i = ph_answer_request(ca->tid, reason, ph_get_call_contact(ca)); 
    20222090 
    20232091  ph_release_call(ca); 
     
    20432111    return -PH_BADCID; 
    20442112 
    2045   i = ph_answer_request(ca->did, reason, uri); 
     2113  i = ph_answer_request(ca->tid, reason, uri); 
    20462114 
    20472115  ph_release_call(ca); 
     
    20662134    return -PH_BADCID; 
    20672135 
    2068   i = ph_answer_request(ca->did, 180, ph_get_call_contact(ca)); 
     2136  i = ph_answer_request(ca->tid, 180, ph_get_call_contact(ca)); 
    20692137 
    20702138  return i; 
     
    21082176 
    21092177 
    2110   i = eXosip_terminate_call(cid, did, ph_get_call_contact(ca)); 
     2178  i = eXosip_call_terminate(cid, did); 
    21112179 
    21122180  ph_release_call(ca); 
     
    22532321      osip_free(vl->contact); 
    22542322 
     2323#if NEWOSIP 
    22552324  if (translate) 
    22562325    { 
     
    22602329    } 
    22612330  else 
     2331#endif 
    22622332      vl->contact = osip_strdup(uri); 
    22632333  return 0; 
     
    23572427 
    23582428  ca->localhold = 1; 
    2359  
     2429#ifdef NEWOSIP  
    23602430  eXosip_lock(); 
    23612431  i = eXosip_on_hold_call(ca->did); 
    23622432  eXosip_unlock(); 
     2433#endif 
    23632434 
    23642435  if (!i && ph_call_hasaudio(ca)) 
     
    24802551  char stmp[256]; 
    24812552  char *server; 
    2482  
     2553  osip_message_t *msg; 
    24832554 
    24842555  assert(vl); 
     
    25062577 
    25072578  eXosip_lock(); 
    2508  
    2509   vl->rid = eXosip_register_init(utmp, server, vl->contact, vl->proxy); 
     2579   
     2580  if (vl->rid >= 0) { 
     2581      ret = eXosip_register_build_register(vl->rid, vl->regTimeout, &msg); 
     2582      if (ret) 
     2583        vl->rid = -2; 
     2584  }  else { 
     2585     
     2586    vl->rid = eXosip_register_build_initial_register(utmp, vl->proxy, vl->contact, vl->regTimeout, &msg); 
     2587 
     2588  } 
    25102589 
    25112590  if (vl->rid >= 0) 
    25122591    { 
    2513       ret = eXosip_register(vl->rid, vl->regTimeout); 
     2592      ret = eXosip_register_send_register(vl->rid, msg); 
    25142593      
    25152594      if (ret == 0) 
     
    25342613  char *ctt; 
    25352614  int i = -1; 
     2615  osip_message_t *msg; 
    25362616 
    25372617  if (!ca) 
     
    25622642       
    25632643      eXosip_lock(); 
    2564       i = eXosip_info_call(ca->did, ctt, buf); 
     2644 
     2645      i = eXosip_call_build_info(ca->did, &msg), 
     2646      ph_req_set_body(msg, buf, ctt); 
     2647      osip_message_set_contact(msg, ph_get_call_contact(ca)); 
     2648      i = eXosip_call_send_request(ca->did, msg); 
     2649 
    25652650      eXosip_unlock(); 
    25662651       
     
    27922877  else 
    27932878  { 
     2879#ifdef NEWOSIP 
    27942880    char contact[512]; 
    27952881    char from[512]; 
     
    27982884    eXosip_guess_contact_uri(from, contact, sizeof(contact), 1); 
    27992885    vl->contact = osip_strdup(contact); 
    2800  
     2886#endif 
     2887     
    28012888  } 
    28022889 
     
    28452932  if (vl->regTimeout) 
    28462933    { 
    2847        
     2934      osip_message_t *msg; 
     2935 
    28482936      eXosip_lock(); 
    2849       eXosip_register(vl->rid, 0); 
     2937      eXosip_register_build_register(vl->rid, 0, &msg); 
     2938      eXosip_register_send_register(vl->rid, msg); 
    28502939      vl->regTimeout = 0; 
    28512940      vl->used = VL_DELETING; 
     
    36923781} 
    36933782 
     3783static int  
     3784ph_get_call_id(int did, char **cid) 
     3785{ 
     3786  char referto[512]; 
     3787  char *cp, *semi; 
     3788  int i; 
     3789 
     3790  i = eXosip_call_get_referto(did, referto, sizeof(referto)); 
     3791  if (i) 
     3792    return -PH_ERROR; 
     3793  cp = strstr(referto, "Replaces"); 
     3794  if (!cp) 
     3795    return -PH_ERROR; 
     3796  cp += 9; 
     3797  semi = strchr(cp, ';'); 
     3798  if (semi) 
     3799    *semi = 0; 
     3800 
     3801  *cid = osip_strdup(cp); 
     3802   
     3803  return *cid ? 0 : -PH_NORESOURCES; 
     3804} 
     3805     
     3806   
     3807 
     3808 
     3809   
     3810   
    36943811MY_DLLEXPORT int 
    36953812phCallGetSipCallID(int cid, char* buf, int bufsize)  
     
    37073824 
    37083825  eXosip_lock(); 
    3709   i = eXosip_get_call_id(ca->did, &callid); 
     3826  i = ph_get_call_id(ca->did, &callid); 
    37103827  eXosip_unlock(); 
    37113828 
     
    39784095{ 
    39794096  char  statusmsg[128]; 
     4097  osip_message_t *notify = 0; 
     4098  int i; 
    39804099 
    39814100  snprintf(statusmsg, sizeof(statusmsg), "SIP/2.0 %d %s", status, msg); 
     
    39834102  eXosip_lock(); 
    39844103 
    3985   eXosip_transfer_send_notify(did, final ? EXOSIP_SUBCRSTATE_TERMINATED : EXOSIP_SUBCRSTATE_ACTIVE, 
    3986                              statusmsg); 
    3987  
     4104 
     4105  eXosip_call_build_notify(did, final ? EXOSIP_SUBCRSTATE_TERMINATED : EXOSIP_SUBCRSTATE_ACTIVE, &notify); 
     4106  if (i) 
     4107    goto err; 
     4108 
     4109 
     4110 
     4111  osip_message_set_body(notify, statusmsg, strlen(statusmsg)); 
     4112  osip_message_set_content_type(notify, "message/sipfrag"); 
     4113 
     4114  i = eXosip_call_send_request(did, notify); 
     4115 
     4116err: 
    39884117  eXosip_unlock(); 
     4118  if (i && (notify != 0)) 
     4119    osip_message_free(notify); 
     4120 
    39894121 
    39904122} 
     
    39944126{ 
    39954127    int  i = 0; 
    3996  
     4128#ifdef NEWOSIP 
    39974129    DBG4_SIP_NEGO("looking for payloads...\n", 0, 0, 0); 
    39984130    DBG4_SIP_NEGO("audio...\n", 0, 0, 0); 
     
    40164148        DBG4_SIP_NEGO("cng: %d", ca->cng, 0, 0); 
    40174149    } 
    4018  
     4150#endif 
    40194151    return i; 
    40204152} 
     
    43964528 
    43974529 
     4530static int  
     4531ph_retrieve_remote_sdp_text(int did, char **buf) 
     4532{ 
     4533  sdp_message_t *sdp =   eXosip_get_remote_sdp(did); 
     4534  if (!sdp) 
     4535    return -1; 
     4536 
     4537  sdp_message_to_str(sdp, buf); 
     4538  return 0; 
     4539} 
     4540 
    43984541void  
    43994542ph_call_new(eXosip_event_t *je) 
     
    44074550  if (ph_busyFlag) 
    44084551    { 
    4409       ph_answer_request(je->did, 486, 0); 
     4552      ph_answer_request(je->tid, 486, 0); 
    44104553      return; 
    44114554    } 
     
    44144557  if (ph_follow_me_addr[0]) 
    44154558    { 
    4416       ph_answer_request(je->did, 302, ph_follow_me_addr); 
     4559      ph_answer_request(je->tid, 302, ph_follow_me_addr); 
    44174560      return; 
    44184561    } 
     
    44234566  if (!info.vlid) 
    44244567    { 
    4425       ph_answer_request(je->did, 404, 0); 
     4568      ph_answer_request(je->tid, 404, 0); 
    44264569      return; 
    44274570    } 
     
    44334576  if (vl->busy) 
    44344577    { 
    4435       ph_answer_request(je->did, 486, vl->contact); 
     4578      ph_answer_request(je->tid, 486, vl->contact); 
    44364579      return; 
    44374580    } 
     
    44404583  if (vl->followme && vl->followme[0]) 
    44414584    { 
    4442       ph_answer_request(je->did, 302, vl->followme); 
     4585      ph_answer_request(je->tid, 302, vl->followme); 
    44434586      return; 
    44444587    } 
     
    44584601    info.callinfo = je->call_info; 
    44594602 
    4460     eXosip_retrieve_remote_sdp_text(je->did, (char **)&info.remoteSdp);  
     4603    ph_retrieve_remote_sdp_text(je->did, (char **)&info.remoteSdp);  
    44614604 
    44624605    phcb->callProgress(ca->cid, &info); 
     
    44644607  else 
    44654608    { 
    4466       ph_answer_request(je->did, 500, vl->contact); 
    4467     } 
    4468  
    4469 #endif 
     4609      ph_answer_request(je->tid, 500, vl->contact); 
     4610    } 
     4611#endif 
     4612 
    44704613} 
    44714614 
     
    55085651        } 
    55095652ans: 
    5510       ph_answer_request(je->did, 200, 0); 
     5653      ph_answer_request(je->tid, 200, 0); 
    55115654 
    55125655    } 
  • phapi/phmedia-audio.c

    r6 r23  
    716716   if (mp != NULL) 
    717717       { 
    718        rtp_set_payload_TYPE(mp,  stream->cngi.cng_pt); 
     718       rtp_set_payload_type(mp,  stream->cngi.cng_pt); 
    719719       rtp_session_sendm_with_ts(stream->ms.rtp_session, mp, timestamp); 
    720720       } 
     
    13921392                if (silok != stream->cngi.lastsil || wakeup) 
    13931393                { 
    1394                         rtp_session_set_markbit(stream->ms.rtp_session, 1); 
    1395                         rtp_session_send_with_ts(stream->ms.rtp_session, data_out_enc, enclen, stream->ms.txtstamp); 
    1396                         rtp_session_set_markbit(stream->ms.rtp_session, 0); 
     1394                  mblk_t *pkt = rtp_session_create_packet(stream->ms.rtp_session, RTP_FIXED_HEADER_SIZE,  
     1395                                                        data_out_enc, enclen); 
     1396                  rtp_set_payload_type(pkt, rtp_session_get_send_payload_type(stream->ms.rtp_session)); 
     1397                  rtp_set_markbit(pkt, 1); 
     1398                  rtp_session_sendm_with_ts(stream->ms.rtp_session, pkt, stream->ms.txtstamp); 
     1399 
    13971400                } 
    13981401                else 
    13991402                { 
    1400                                 rtp_session_send_with_ts(stream->ms.rtp_session, data_out_enc, enclen, stream->ms.txtstamp); 
     1403                  rtp_session_send_with_ts(stream->ms.rtp_session, data_out_enc, enclen, stream->ms.txtstamp); 
    14011404                } 
    14021405 
     
    25142517  DBG2_MEDIA_ENGINE("ph_msession_audio_start: rtpsession's qos: %d\n", s->qos); 
    25152518  if(s->qos) 
    2516       rtp_session_set_qos(session, s->qos); 
     2519      rtp_session_set_dscp(session, s->qos); 
    25172520 
    25182521#ifdef USE_HTTP_TUNNEL 
     
    25562559    } 
    25572560 
    2558   rtp_session_set_profiles(session, sprofile, rprofile); 
     2561  rtp_session_set_send_profile(session, sprofile); 
     2562  rtp_session_set_recv_profile(session, rprofile); 
     2563 
    25592564  rtp_session_set_jitter_compensation(session, sp->jitter); 
    25602565 
     
    25652570  rtp_session_set_remote_addr(session, sp->remoteaddr,sp->remoteport); 
    25662571 
    2567   rtp_session_set_payload_types(session, sp->opayloads[0].number, sp->ipayloads[0].number); 
    2568   rtp_session_set_cng_pt(session, stream->cngi.cng_pt); 
     2572  rtp_session_set_send_payload_type(session, sp->opayloads[0].number); 
     2573  rtp_session_set_recv_payload_type(session, sp->ipayloads[0].number); 
     2574 
     2575 
    25692576  rtp_session_signal_connect(session, "telephone-event", 
    25702577                             (RtpCallback)ph_telephone_event, s); 
     2578#ifdef NEWOSIP 
     2579  rtp_session_set_cng_pt(session, stream->cngi.cng_pt); 
    25712580  rtp_session_signal_connect(session, "cng_packet", 
    25722581                             (RtpCallback)ph_on_cng_packet, s); 
    2573  
     2582#endif 
    25742583 
    25752584  sp->flags |= PH_MSTREAM_FLAG_RUNNING; 
     
    27262735                        (RtpCallback)ph_on_cng_packet); 
    27272736 
    2728   ortp_set_debug_file("oRTP", stdout);  
     2737  ortp_set_log_file(stdout);  
    27292738  //  ortp_global_stats_display(); 
    2730   ortp_session_stats_display(stream->ms.rtp_session); 
    2731   ortp_set_debug_file("oRTP", NULL);  
     2739  rtp_stats_display(rtp_session_get_stats(stream->ms.rtp_session), "Audio stream stats"); 
     2740  ortp_set_log_file(NULL);  
    27322741 
    27332742 { 
  • phapi/phmedia-video.c

    r0 r23  
    11961196 
    11971197 
    1198   ortp_set_debug_file("oRTP", stdout); 
    1199   ortp_session_stats_display(stream->ms.rtp_session); 
    1200   ortp_set_debug_file("oRTP", NULL); 
     1198  ortp_set_log_file(stdout); 
     1199  rtp_stats_display(rtp_session_get_stats(stream->ms.rtp_session), "Video stream stats"); 
     1200  ortp_set_log_file(NULL); 
    12011201 
    12021202  rtp_session_destroy(stream->ms.rtp_session); 
     
    12531253        ca->ph_video_stream = 0; 
    12541254 
    1255         ortp_set_debug_file("oRTP", stdout); 
    1256         ortp_session_stats_display(stream->ms.rtp_session); 
    1257         ortp_set_debug_file("oRTP", NULL); 
     1255        ortp_set_log(stdout); 
     1256        rtp_stats_display(rtp_session_get_stats(stream->ms.rtp_session), "Video stream stats"); 
     1257        ortp_set_log_file(NULL); 
    12581258 
    12591259        rtp_session_destroy(stream->ms.rtp_session); 
Note: See TracChangeset for help on using the changeset viewer.