~ubuntu-branches/ubuntu/vivid/linphone/vivid

« back to all changes in this revision

Viewing changes to exosip/jcall.c

  • Committer: Bazaar Package Importer
  • Author(s): Samuel Mimram
  • Date: 2006-11-15 10:34:50 UTC
  • mfrom: (1.2.1 upstream) (2.1.8 feisty)
  • Revision ID: james.westby@ubuntu.com-20061115103450-qgafwcks2lkhctlj
* New upstream release.
* Enable video support.
* Fix mismatched #endif in mscommon.h, closes: #398307.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
  eXosip - This is the eXtended osip library.
 
3
  Copyright (C) 2002, 2003  Aymeric MOIZARD  - jack@atosc.org
 
4
  
 
5
  eXosip is free software; you can redistribute it and/or modify
 
6
  it under the terms of the GNU General Public License as published by
 
7
  the Free Software Foundation; either version 2 of the License, or
 
8
  (at your option) any later version.
 
9
  
 
10
  eXosip is distributed in the hope that it will be useful,
 
11
  but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
  GNU General Public License for more details.
 
14
  
 
15
  You should have received a copy of the GNU General Public License
 
16
  along with this program; if not, write to the Free Software
 
17
  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
*/
 
19
 
 
20
 
 
21
#ifdef ENABLE_MPATROL
 
22
#include <mpatrol.h>
 
23
#endif
 
24
 
 
25
 
 
26
#include "eXosip2.h"
 
27
#include <eXosip_cfg.h>
 
28
 
 
29
extern eXosip_t eXosip;
 
30
 
 
31
int eXosip_call_find(int cid, eXosip_call_t **jc)
 
32
{
 
33
  for (*jc=eXosip.j_calls; *jc!=NULL; *jc=(*jc)->next)
 
34
    {
 
35
      if ((*jc)->c_id==cid)
 
36
        {
 
37
          return 0;
 
38
        }
 
39
    }
 
40
  *jc = NULL;
 
41
  return -1;
 
42
}
 
43
 
 
44
int
 
45
eXosip_call_init(eXosip_call_t **jc)
 
46
{
 
47
  *jc = (eXosip_call_t *)osip_malloc(sizeof(eXosip_call_t));
 
48
  if (*jc == NULL) return -1;
 
49
  memset(*jc, 0, sizeof(eXosip_call_t));
 
50
 
 
51
  (*jc)->c_id = -1;   /* make sure the eXosip_update will assign a valid id to the call */
 
52
  osip_negotiation_ctx_init(&(*jc)->c_ctx);
 
53
  return 0;
 
54
}
 
55
 
 
56
void
 
57
__eXosip_call_remove_dialog_reference_in_call(eXosip_call_t *jc, eXosip_dialog_t *jd)
 
58
{
 
59
  eXosip_dialog_t *_jd;
 
60
  jinfo_t *ji;
 
61
  if (jc==NULL) return;
 
62
  if (jd==NULL) return;
 
63
 
 
64
 
 
65
  for (_jd = jc->c_dialogs; _jd!=NULL; _jd=jc->c_dialogs)
 
66
    {
 
67
      if (jd==_jd)
 
68
        break;
 
69
    }
 
70
  if (_jd==NULL)
 
71
    {
 
72
      /* dialog not found??? */
 
73
    }
 
74
 
 
75
  ji = osip_transaction_get_your_instance(jc->c_inc_tr);
 
76
  if (ji!=NULL && ji->jd==jd)
 
77
    ji->jd=NULL;
 
78
  ji = osip_transaction_get_your_instance(jc->c_out_tr);
 
79
  if (ji!=NULL && ji->jd==jd)
 
80
    ji->jd=NULL;
 
81
}
 
82
 
 
83
void
 
84
eXosip_call_free(eXosip_call_t *jc)
 
85
{
 
86
  /* ... */
 
87
 
 
88
  eXosip_dialog_t *jd;
 
89
 
 
90
  for (jd = jc->c_dialogs; jd!=NULL; jd=jc->c_dialogs)
 
91
    {
 
92
      REMOVE_ELEMENT(jc->c_dialogs, jd);
 
93
      eXosip_dialog_free(jd);
 
94
    }
 
95
 
 
96
  __eXosip_delete_jinfo(jc->c_inc_tr);
 
97
  __eXosip_delete_jinfo(jc->c_out_tr);
 
98
  if (jc->c_inc_tr!=NULL)
 
99
    osip_list_add(eXosip.j_transactions, jc->c_inc_tr, 0);
 
100
  if (jc->c_out_tr!=NULL)
 
101
    osip_list_add(eXosip.j_transactions, jc->c_out_tr, 0);
 
102
 
 
103
  __eXosip_delete_jinfo(jc->c_inc_options_tr);
 
104
  __eXosip_delete_jinfo(jc->c_out_options_tr);
 
105
  if (jc->c_inc_options_tr!=NULL)
 
106
    osip_list_add(eXosip.j_transactions, jc->c_inc_options_tr, 0);
 
107
  if (jc->c_out_options_tr!=NULL)
 
108
    osip_list_add(eXosip.j_transactions, jc->c_out_options_tr, 0);
 
109
  
 
110
 
 
111
  osip_negotiation_ctx_free(jc->c_ctx);
 
112
  osip_free(jc);
 
113
 
 
114
}
 
115
 
 
116
void
 
117
eXosip_call_set_subject(eXosip_call_t *jc, char *subject)
 
118
{
 
119
  if (jc==NULL||subject==NULL||subject[0]=='\0') return;
 
120
  snprintf(jc->c_subject, 99, "%s", subject);
 
121
}
 
122