BelledonneCommunications / flexisip

Linphone.org mirror for flexisip (git://git.linphone.org/flexisip.git)
http://flexisip.org
GNU Affero General Public License v3.0
140 stars 68 forks source link

Asterisk as backend Server And flexisip as Proxy server for push gateway #163

Open E2-Sterlin opened 1 year ago

E2-Sterlin commented 1 year ago

I tried integrating flexisip with asterisk as backend sip server to support RFC8599, but the configuration of flexisip seems tricky ,couldn't configure properly , Do any one have proper configuration for flexisip as push gateway ,If so kindly share :)

sanjayws commented 1 year ago

I have done it before and it takes a huge amount of effort to figure out yourself. Documentation is scarce and not really up to date. I integrated Asterisk with PJSIP and this. There are lots of things you need to do like certs, firebase setup, apple APN etc to get it working then there's the flexisip.conf file which i can share with you if that's what you need.

When we got it working back in 2021, our biggest issue was multiple registration issues with Asterisk which you have to allow as the Flexisip and actual SIP client need to register (twice) per extension, so its best to use pjsip or a heavily modified chan_sip (which i don't recommend) ...

E2-Sterlin commented 1 year ago

Thanks for your response and guidance , could you please share the conf file ,so that I will compare with my configuration. :)

sanjayws commented 1 year ago

Hi, here you go, please cross check it against your setup. This config worked well in late 2021. There might be newer parameters in the .conf file that you may have.

Some private URI, IP is redacted with <>

Good luck!

[global]
log-level=message
log-directory=/var/opt/belledonne-communications/log/flexisip
log-filename=flexisip-Log.log
syslog-level=message
user-errors-logs=true
dump-corefiles=false
auto-respawn=true
aliases=<any alias, e.g. localhost, servername.domain.com I-address of your server from external>
default-servers=proxy
transports=sip:<listening_ip_name>:<listening_port>;transport=udp;maddr=<nat_ip_if_any>
tls-certificates-dir=/etc/flexisip/tls/
tls-ciphers=HIGH:!SSLv2:!SSLv3:!TLSv1:!EXP:!ADH:!RC4:!3DES:!aNULL:!eNULL
proxy-to-proxy-keepalive-interval=0
idle-timeout=3600
require-peer-certificate=false
transaction-timeout=36000
udp-mtu=1460
enable-snmp=false
unique-id=
use-maddr=true
plugins-dir=/usr/lib/flexisip/plugins/
plugins=

[cluster]
enabled=false
cluster-domain=
nodes=
internal-transport=sip:%auto:5059;transport=tcp

[mdns-register]
enabled=false
mdns-priority=0
mdns-weight=100
mdns-ttl=3600

[event-logs]
enabled=false
logger=filesystem
dir=/var/opt/belledonne-communications/log/flexisip
database-backend=mysql
database-connection-string=db='mydb' user='myuser' password='mypass' host='myhost.com'
database-max-queue-size=100
database-nb-threads-max=10

[monitor]
enabled=false
test-interval=30
logfile=/etc/flexisip/flexisip_monitor.log
switch-port=12345
password-salt=

[stun-server]
enabled=true
bind-address=0.0.0.0
port=3478

[presence-server]
enabled=true
transports=sip:127.0.0.1:5065;transport=tcp
expires=600
notify-limit=200
leak-detector=false
long-term-enabled=true
bypass-condition=false

[conference-server]
enabled=false
transport=sip:127.0.0.1:6064;transport=udp
conference-factory-uri=
enable-one-to-one-chat-room=true
outbound-proxy=sip:127.0.0.1:5060;transport=udp
database-backend=mysql
database-connection-string=db='flexisip' user='<user>' password='<pass>' host='localhost'

[module::DoSProtection]
enabled=true
filter=
time-period=3000
packet-rate-limit=20
ban-time=600
iptables-chain=FLEXISIP

[module::SanityChecker]
enabled=true
filter=

[module::GarbageIn]
enabled=true
filter=false

[module::NatHelper]
enabled=true
filter=
contact-verified-param=verified
fix-record-routes=true
fix-record-routes-policy=safe

[module::Authentication]
enabled=false
filter=
auth-domains=localhost
trusted-hosts=
db-implementation=
datasource=
nonce-expires=3600
cache-expire=1800
no-403=false
reject-wrong-client-certificates=false
tls-client-certificate-required-subject=
new-auth-on-407=false
enable-test-accounts-creation=false
disable-qop-auth=false
available-algorithms=MD5
trust-domain-certificates=false
soci-password-request=select password, 'MD5' from accounts where login = :id and domain = :domain
soci-user-with-phone-request=
soci-users-with-phones-request=
soci-poolsize=100
soci-backend=mysql
soci-connection-string=db=mydb user=myuser password='mypass' host=myhost.com
soci-max-queue-size=1000

[module::Redirect]
enabled=false
filter=
contact=

[module::Registrar]
enabled=true
filter=
reg-domains=*
reg-on-response=true
max-contacts-by-aor=12
unique-id-parameters=+sip.instance pn-tok line
max-expires=604800
min-expires=604800
force-expires=-1
static-records-file=
static-records-timeout=6000
db-implementation=redis
redis-server-domain=localhost
redis-server-port=6379
redis-auth-password=
redis-server-timeout=1500
redis-record-serializer=protobuf
redis-slave-check-period=60
service-route=
name-message-expires=message-expires
register-expire-randomizer-max=

[module::StatisticsCollector]
enabled=true
filter=is_request && request.method-name == 'PUBLISH'
collector-address=

[module::Router]
enabled=true
filter=(is_request && request.uri.params contains 'doroute') || is_response
use-global-domain=false
fork=true
stateful=true
fork-late=true
fork-no-global-decline=false
treat-decline-as-urgent=false
treat-all-as-urgent=false
call-fork-timeout=90
call-fork-urgent-timeout=0
call-fork-current-branches-timeout=0
call-push-response-timeout=0
message-fork-late=false
message-delivery-timeout=604800
message-accept-timeout=15
allow-target-factorization=true
generated-contact-route=false
generated-contact-expected-realm=
generate-contact-even-on-filled-aor=false
preroute=
resolve-routes=false
fallback-route=
parent-domain-fallback=false

[module::PushNotification]
enabled=true
filter=
timeout=0
max-queue-size=100
time-to-live=2592000
apple=true
apple-certificate-dir=<location_of_your_apple_apn_cert>
firebase=true
firebase-projects-api-keys=<your_firebase_key>
no-badge=false
#retransmission-count=0
#retransmission-interval=0
display-from-uri=false

[module::ContactRouteInserter]
enabled=true
insert-domain=true

[module::MediaRelay]
enabled=false
filter=
nortpproxy=nortpproxy
sdp-port-range-min=7000
sdp-port-range-max=9000
bye-orphan-dialogs=false
max-calls=0
force-relay-for-non-ice-targets=true
prevent-loops=true
early-media-relay-single=true
max-early-media-per-call=0
inactivity-period=3600

[module::Transcoder]
enabled=false
filter=
jb-nom-size=0
rc-user-agents=
audio-codecs=speex/8000 amr/8000 iLBC/8000 gsm/8000 pcmu/8000 pcma/8000 telephone-event/8000 opus/48000
remove-bw-limits=false
block-retransmissions=false

[module::Forward]
enabled=true
filter=
#route to dua
route=<sip:<your_asterisk_ip>:<your_asterisk_port>;transport=udp>
add-path=true
rewrite-req-uri=false
default-transport=udp
params-to-remove=

[inter-domain-connections]
accept-domain-registrations=false
assume-unique-domains=false
domain-registrations=/etc/flexisip/domain-registrations.conf
verify-server-certs=true
keepalive-interval=30
reg-when-needed=true
E2-Sterlin commented 1 year ago

thank you

NLLAPPS commented 1 year ago

Hi all, I have been paying around with Flexisip in my lab in order to use it as push gateway only. My requirement is that Flexisip is just a relay proxy used as push gateway where only INVITE and REGISTER goes through it. There can be any number of back-end server and many different users.

Configuration was easy and I was able to make push messages working fine with below config. Unfortunately there seems to be bugs with Flexisip regarding such config. I have hit https://github.com/BelledonneCommunications/flexisip/issues/54 which was created Mar 6, 2019

According to my tests, outgoing calls work but disconnect after 30 seconds. Incoming calls are never acknowledged so that to remote server call is still ringing even though client send accept requests to Flexisip server.

My config

[global] default-servers=proxy log-level=debug syslog-level=error user-errors-logs=true transports=sip:sip.test.com:6262 sips:sip.test.com:6263 aliases=sip.test.com

[presence-server] enabled=false

[stun-server] enabled=false

[conference-server] enabled=false

[module::Registrar] enabled=true reg-domains=* reg-on-response=true max-expires=604800

[module::Router] filter=(is_request && request.uri.params contains 'doroute') || is_response fork-late=true

[module::PushNotification] enabled=true display-from-uri=true firebase=true firebase-projects-api-keys=senderid:serverkey

[module::ContactRouteInserter] enabled=true insert-domain=true

[module::MediaRelay] enabled=false

Sterlin11 commented 1 year ago

@sanjayws Thanks for the above configuration you gave for flexisip ,and I tried with flexisip_pusher for test .Voip notification working fine . But I am facing trouble while integrating it with Asterisk .(Asterisk as SIP server and Flexisip as push gateway). Do you have any configuration file that need to be configured in Asterisk side to communicate with flexisip . So that Asterisk might support RFC 8599 .