Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug tcp invalid contact string #322

Open
wants to merge 8 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM debian:bullseye-slim

RUN apt-get update \
&& apt-get -y --quiet --force-yes upgrade \
&& apt-get install -y --no-install-recommends ca-certificates gcc g++ make build-essential cmake git autoconf automake curl libtool libtool-bin libssl-dev libcurl4-openssl-dev zlib1g-dev libgoogle-perftools-dev \
&& apt-get install -y --no-install-recommends ca-certificates gcc g++ make build-essential cmake git autoconf automake curl libtool libtool-bin libssl-dev libcurl4-openssl-dev zlib1g-dev libgoogle-perftools-dev iproute2 \
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

prefer to remove changes from Dockerfile from this PR

&& git clone --depth=50 --branch=main https://github.com/drachtio/drachtio-server.git /usr/local/src/drachtio-server \
&& cd /usr/local/src/drachtio-server \
&& git submodule update --init --recursive \
Expand Down
9 changes: 8 additions & 1 deletion entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ case $CLOUD in
;;
esac

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think this change has anything to do with the stated issue, could it be removed from the PR

if [ -f "/proc/1/cgroup" ]; then
# Docker container
LOCAL_IP=$(ip route get 1.1.1.1 | grep -oP 'src \K\S+')
fi

if [ "$1" = 'drachtio' ]; then
shift

Expand All @@ -58,7 +63,9 @@ if [ "$1" = 'drachtio' ]; then
;;

*)
MYARGS+=($1)
thisarg="${1//PUBLIC_IP/"$PUBLIC_IP"}"
thisarg="${thisarg//LOCAL_IP/"$LOCAL_IP"}"
MYARGS+=($thisarg)
;;
esac

Expand Down
12 changes: 11 additions & 1 deletion src/sip-dialog-controller.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -462,7 +462,17 @@ namespace drachtio {
string port = tpn->tpn_port ;
string proto = tpn->tpn_proto ;

contact = "<sip:" + host + ":" + port + ";transport=" + proto + ">";
if( "tcp" == proto ) {
pSelectedTransport = SipTransport::findAppropriateTransport( useOutboundProxy ? sipOutboundProxy.c_str() : requestUri.c_str()) ;
if (pSelectedTransport) {
davehorton marked this conversation as resolved.
Show resolved Hide resolved
pSelectedTransport->getDescription( desc ) ;
pSelectedTransport->getContactUri( contact, true ) ;
contact = "<" + contact + ">" ;
DR_LOG(log_debug) << "SipDialogController::doSendRequestOutsideDialog - modifying contact " << std::hex << (void*)tp << ": " << desc << " for request-uri " << requestUri << " to " << contact ;
}
} else {
contact = "<sip:" + host + ":" + port + ";transport=" + proto + ">";
}
}
}
if( NULL == tp ) {
Expand Down