Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
BC
public
belle-sip
Commits
3f1643d1
Commit
3f1643d1
authored
Sep 28, 2016
by
jehan
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Change find_dialog_function to use local&remote tag as parameters
parent
712bad64
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
35 deletions
+17
-35
include/belle-sip/provider.h
include/belle-sip/provider.h
+3
-3
src/provider.c
src/provider.c
+14
-32
No files found.
include/belle-sip/provider.h
View file @
3f1643d1
...
...
@@ -96,12 +96,12 @@ BELLESIP_EXPORT void belle_sip_provider_set_unconditional_answer(belle_sip_provi
* Provides access to a specific dialog
* @param prov object
* @param call_if of the dialog
* @param
from
_tag of the dialog
* @param
to
_tag of the dialog
* @param
local
_tag of the dialog
* @param
remote
_tag of the dialog
* @returns dialog corresponding to this parameter or NULL if not found
*
**/
BELLESIP_EXPORT
belle_sip_dialog_t
*
belle_sip_provider_find_dialog
(
const
belle_sip_provider_t
*
prov
,
const
char
*
call_id
,
const
char
*
from
_tag
,
const
char
*
to
_tag
);
BELLESIP_EXPORT
belle_sip_dialog_t
*
belle_sip_provider_find_dialog
(
const
belle_sip_provider_t
*
prov
,
const
char
*
call_id
,
const
char
*
local
_tag
,
const
char
*
remote
_tag
);
/**
* Enable rport in via header. Enabled by default
...
...
src/provider.c
View file @
3f1643d1
...
...
@@ -631,41 +631,34 @@ belle_sip_dialog_t * belle_sip_provider_create_dialog_internal(belle_sip_provide
return
dialog
;
}
/*find a dialog given the call id,
from
-tag and to-tag*/
belle_sip_dialog_t
*
belle_sip_provider_find_dialog
(
const
belle_sip_provider_t
*
prov
,
const
char
*
call_id
,
const
char
*
from
_tag
,
const
char
*
to
_tag
)
{
/*find a dialog given the call id,
local
-tag and to-tag*/
belle_sip_dialog_t
*
belle_sip_provider_find_dialog
(
const
belle_sip_provider_t
*
prov
,
const
char
*
call_id
,
const
char
*
local
_tag
,
const
char
*
remote
_tag
)
{
belle_sip_list_t
*
iterator
;
if
(
call_id
==
NULL
||
from_tag
==
NULL
||
to_tag
==
NULL
)
{
belle_sip_dialog_t
*
returned_dialog
=
NULL
;
if
(
call_id
==
NULL
||
local_tag
==
NULL
||
remote_tag
==
NULL
)
{
return
NULL
;
}
for
(
iterator
=
prov
->
dialogs
;
iterator
!=
NULL
;
iterator
=
iterator
->
next
)
{
belle_sip_dialog_t
*
dialog
=
(
belle_sip_dialog_t
*
)
iterator
->
data
;
if
(
belle_sip_dialog_get_state
(
dialog
)
!=
BELLE_SIP_DIALOG_NULL
&&
strcmp
(
belle_sip_header_call_id_get_call_id
(
belle_sip_dialog_get_call_id
(
dialog
)),
call_id
)
==
0
)
{
const
char
*
target_from
;
const
char
*
target_to
;
if
(
belle_sip_dialog_is_server
(
dialog
))
{
target_to
=
belle_sip_dialog_get_local_tag
(
dialog
);
target_from
=
belle_sip_dialog_get_remote_tag
(
dialog
);
}
else
{
target_from
=
belle_sip_dialog_get_local_tag
(
dialog
);
target_to
=
belle_sip_dialog_get_remote_tag
(
dialog
);
}
if
(
strcmp
(
from_tag
,
target_from
)
==
0
&&
strcmp
(
to_tag
,
target_to
)
==
0
)
{
return
dialog
;
}
dialog
=
(
belle_sip_dialog_t
*
)
iterator
->
data
;
/*ignore dialog in state BELLE_SIP_DIALOG_NULL, is it really the correct things to do*/
if
(
belle_sip_dialog_get_state
(
dialog
)
!=
BELLE_SIP_DIALOG_NULL
&&
_belle_sip_dialog_match
(
dialog
,
call_id
,
local_tag
,
remote_tag
))
{
if
(
!
returned_dialog
)
returned_dialog
=
dialog
;
else
belle_sip_fatal
(
"More than 1 dialog is matching, check your app"
);
}
}
return
NULL
;
return
returned_dialog
;
}
/*finds an existing dialog for an outgoing or incoming message */
belle_sip_dialog_t
*
belle_sip_provider_find_dialog_from_message
(
belle_sip_provider_t
*
prov
,
belle_sip_message_t
*
msg
,
int
as_uas
){
belle_sip_dialog_t
*
returned_dialog
=
NULL
,
*
dialog
;
belle_sip_header_call_id_t
*
call_id
;
belle_sip_header_from_t
*
from
;
belle_sip_header_to_t
*
to
;
belle_sip_list_t
*
elem
;
const
char
*
from_tag
;
const
char
*
to_tag
;
const
char
*
call_id_value
;
...
...
@@ -692,18 +685,7 @@ belle_sip_dialog_t *belle_sip_provider_find_dialog_from_message(belle_sip_provid
call_id_value
=
belle_sip_header_call_id_get_call_id
(
call_id
);
local_tag
=
as_uas
?
to_tag
:
from_tag
;
remote_tag
=
as_uas
?
from_tag
:
to_tag
;
for
(
elem
=
prov
->
dialogs
;
elem
!=
NULL
;
elem
=
elem
->
next
){
dialog
=
(
belle_sip_dialog_t
*
)
elem
->
data
;
/*ignore dialog in state BELLE_SIP_DIALOG_NULL, is it really the correct things to do*/
if
(
belle_sip_dialog_get_state
(
dialog
)
!=
BELLE_SIP_DIALOG_NULL
&&
_belle_sip_dialog_match
(
dialog
,
call_id_value
,
local_tag
,
remote_tag
))
{
if
(
!
returned_dialog
)
returned_dialog
=
dialog
;
else
belle_sip_fatal
(
"More than 1 dialog is matching, check your app"
);
}
}
return
returned_dialog
;
return
belle_sip_provider_find_dialog
(
prov
,
call_id_value
,
local_tag
,
remote_tag
);
}
void
belle_sip_provider_add_dialog
(
belle_sip_provider_t
*
prov
,
belle_sip_dialog_t
*
dialog
){
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment