[Gelöst] Umstieg SIP auf PJSIP

awjnrgvf

Neuer User
Mitglied seit
27 Mrz 2011
Beiträge
7
Punkte für Reaktionen
1
Punkte
3
[Asterisk 17.3]
Hallo liebe VoIP-Begeisterte,

Das Ziel:
ich möchte gerne ein Script schreiben, welches die passende Asterisk Konfiguration auf Basis einer Grundinstallation über eine Art Baukastensystem ausgibt. Hierzu möchte ich ungerne eine veraltete Konfigurationsmethode (SIP.conf) nutzen, da ich das Script nicht in 1-2 Jahren komplett neu schreiben möchte.

Das habe ich getan:
Nun habe ich, da die Dokumentationen für mich zu unklar waren (z.B. was ist eine "Line"? Was ist in diesem Fall genau ein "Endpunkt"? Etc etc.), das SIP to PJSIP Migrationsscript verwendet, um zu versuchen es an meinem eigenen Dialplan besser verstehen zu können.

Mein Problem:
Mit meiner PJSIP-Konfiguration kann ich zwar über VoIP2GSM nach draußen telefonieren, aber jedes Mal, wenn ich versuche meine Nummer anzurufen, wird entweder sofort aufgelegt (über VoIP2GSM) oder es erfolgt die Ansage: "Der gewünschte Gesprächspartner ist zur Zeit nicht erreichbar" (Sipgate).

Ich habe mal alle Änderungen, die getätigt wurden, zurückgesetzt und euch das unverpfuschte Script beigefügt, welches das Migrationsscript ausgegeben hat:
Meine Konfiguration:
pjsip.conf
Code:
;--
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Non mapped elements start
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

[general]
allowguest = no

[sipgate]
defaultuser = 999999e0

[voipgsm]
qualify = yes

[286333500]
defaultuser = 286333500

[286333501]
defaultuser = 286333501

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
Non mapped elements end
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
--;


[global]
type = global
user_agent = My VoIP Server

[transport-udp]
type = transport
protocol = udp
bind = 0.0.0.0

[reg_sipgate.de]
type = registration
retry_interval = 20
max_retries = 10
contact_user = 5000
expiration = 120
transport = transport-udp
outbound_auth = auth_reg_sipgate.de
client_uri = sip:[email protected]
server_uri = sip:sipgate.de

[auth_reg_sipgate.de]
type = auth
password = MYSUPERCOOLPASSWORD1
username = 999999e0

[reg_sipz1.voip2gsm.de]
type = registration
retry_interval = 20
max_retries = 10
contact_user = 5001
expiration = 120
transport = transport-udp
outbound_auth = auth_reg_sipz1.voip2gsm.de
client_uri = sip:[email protected]
server_uri = sip:sipz1.voip2gsm.de

[auth_reg_sipz1.voip2gsm.de]
type = auth
password = MYSUPERCOOLPASSWORD2
username = 99999.01

[sipgate]
type = aor
contact = sip:[email protected]:5060

[sipgate]
type = identify
endpoint = sipgate
match = sipgate.de

[sipgate]
type = auth
username = sipgate
password = MYSUPERCOOLPASSWORD1

[sipgate]
type = endpoint
context = von-sipgate
disallow = all
allow = alaw
allow = ulaw
allow = gsm
direct_media = no
inband_progress = no
allow_transfer = no
from_user = 999999e0
from_domain = sipgate.de
language = de
auth = sipgate
outbound_auth = sipgate
aors = sipgate

[voipgsm]
type = aor
contact = sip:[email protected]:5060

[voipgsm]
type = identify
endpoint = voipgsm
match = sipz1.voip2gsm.de

[voipgsm]
type = auth
username = voipgsm
password = MYSUPERCOOLPASSWORD2

[voipgsm]
type = endpoint
context = von-voipgsm
disallow = all
allow = alaw
allow = ulaw
allow = gsm
direct_media = no
inband_progress = no
allow_transfer = no
from_user = 99999.01
from_domain = sipz1.voip2gsm.de
language = de
auth = voipgsm
outbound_auth = voipgsm
aors = voipgsm

[286333500]
type = aor
max_contacts = 1

[286333500]
type = auth
username = 286333500
password = MYSUPERCOOLPASSWORD3

[286333500]
type = endpoint
context = dialvoipgsm
disallow = all
allow = alaw
allow = ulaw
allow = gsm
direct_media = no
inband_progress = no
allow_transfer = no
language = de
auth = 286333500
outbound_auth = 286333500
aors = 286333500

[286333501]
type = aor
max_contacts = 1

[286333501]
type = auth
username = 286333501
password = MYSUPERCOOLPASSWORD4

[286333501]
type = endpoint
context = dialvoipgsm
disallow = all
allow = alaw
allow = ulaw
allow = gsm
direct_media = no
inband_progress = no
allow_transfer = no
language = de
auth = 286333501
outbound_auth = 286333501
aors = 286333501

extensions.conf
Code:
[general]
context=bogus
alwaysauthreject=yes
allowguest=no
static=yes
writeprotect=no
clearglobalvars=no

[demo]
[public]
[default]
[von-sipgate]
exten => 5000,1,Answer()
exten => 5000,n,Playback(hello)
exten => 5000,n,Hangup()

[von-voipgsm]
exten => _X.,1,Answer()
exten => _X.,n,Wait(1)
exten => _X.,n,Playback(hello)
exten => _X.,n,Hangup()

exten => _+49[1-9].,1,Answer()
exten => _+49[1-9].,n,Wait(1)
;exten => _+49[1-9].,n,Playback(hello)
exten => _+49[1-9].,n,Hangup()

[dialvoipgsm]
exten => 1,1,Answer()
;exten => 1,n,Playback(hello)
exten => 1,n,Dial(PJSIP/0123456789@voipgsm)

exten => _0[1-9].,1,Dial(PJSIP/${EXTEN}@voipgsm)
exten => _+49[1-9].,1,Dial(PJSIP/${EXTEN}@voipgsm)

exten => 5123,1,Answer()
exten => 5123,n,SayUnixTime(,CET,adBYIMp)
exten => 5123,n,Hangup()

Nun im CLI "core set debug 4", "core set verbose 4" und "pjsip set logger on" eingestellt und meine VoIP2GSM-Nummer anrufen lassen:
Log Ausgabe:
Code:
<--- Received SIP request (669 bytes) from UDP:123.45.67.89:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Max-Forwards: 69
Via: SIP/2.0/UDP 123.45.67.89:5060;rport;branch=z9hG4bK1660404580
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1790337268
To: <sip:[email protected]:5060>
Call-ID: 1328953546@sipz1
CSeq: 264 INVITE
User-Agent: YATE
Contact: <sip:[email protected]:5060>
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
Content-Type: application/sdp
Content-Length: 207

v=0
o=yate 1584896177 1584896177 IN IP4 123.45.67.89
s=SIP Call
c=IN IP4 123.45.67.89
t=0 0
m=audio 42966 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000

<--- Transmitting SIP response (477 bytes) to UDP:123.45.67.89:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 123.45.67.89:5060;rport=5060;received=123.45.67.89;branch=z9hG4bK1660404580
Call-ID: 1328953546@sipz1
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1790337268
To: <sip:[email protected]>;tag=z9hG4bK1660404580
CSeq: 264 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1584896177/e6af051fb68571dadd3b5db7e0f8d5e5",opaque="0f10a9353d880f84",algorithm=md5,qop="auth"
Server: My VoIP Server
Content-Length:  0


<--- Received SIP request (380 bytes) from UDP:123.45.67.89:5060 --->
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 123.45.67.89:5060;rport;branch=z9hG4bK1660404580
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1790337268
To: <sip:[email protected]:5060>;tag=z9hG4bK1660404580
Call-ID: 1328953546@sipz1
CSeq: 264 ACK
Max-Forwards: 69
Contact: <sip:[email protected]:5060>
User-Agent: YATE
Content-Length: 0


<--- Received SIP request (667 bytes) from UDP:123.45.67.89:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Max-Forwards: 69
Via: SIP/2.0/UDP 123.45.67.89:5060;rport;branch=z9hG4bK656332414
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1310926967
To: <sip:[email protected]:5060>
Call-ID: 591734355@sipz1
CSeq: 265 INVITE
User-Agent: YATE
Contact: <sip:[email protected]:5060>
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
Content-Type: application/sdp
Content-Length: 207

v=0
o=yate 1584896177 1584896177 IN IP4 123.45.67.89
s=SIP Call
c=IN IP4 123.45.67.89
t=0 0
m=audio 52058 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000

<--- Transmitting SIP response (474 bytes) to UDP:123.45.67.89:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 123.45.67.89:5060;rport=5060;received=123.45.67.89;branch=z9hG4bK656332414
Call-ID: 591734355@sipz1
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1310926967
To: <sip:[email protected]>;tag=z9hG4bK656332414
CSeq: 265 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1584896177/e6af051fb68571dadd3b5db7e0f8d5e5",opaque="092a2ba75af2bf65",algorithm=md5,qop="auth"
Server: My VoIP Server
Content-Length:  0


<--- Received SIP request (377 bytes) from UDP:123.45.67.89:5060 --->
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 123.45.67.89:5060;rport;branch=z9hG4bK656332414
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1310926967
To: <sip:[email protected]:5060>;tag=z9hG4bK656332414
Call-ID: 591734355@sipz1
CSeq: 265 ACK
Max-Forwards: 69
Contact: <sip:[email protected]:5060>
User-Agent: YATE
Content-Length: 0

An dieser Stelle folgt eine kurze Pause, in der gar nichts passiert (kein Freizeichen oder sonst was), nach 7-8 Sekunden kommt dann:
Code:
<--- Received SIP request (667 bytes) from UDP:123.45.67.89:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Max-Forwards: 69
Via: SIP/2.0/UDP 123.45.67.89:5060;rport;branch=z9hG4bK2095962614
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=347609550
To: <sip:[email protected]:5060>
Call-ID: 459226380@sipz1
CSeq: 266 INVITE
User-Agent: YATE
Contact: <sip:[email protected]:5060>
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
Content-Type: application/sdp
Content-Length: 207

v=0
o=yate 1584896185 1584896185 IN IP4 123.45.67.89
s=SIP Call
c=IN IP4 123.45.67.89
t=0 0
m=audio 36000 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000

<--- Transmitting SIP response (475 bytes) to UDP:123.45.67.89:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 123.45.67.89:5060;rport=5060;received=123.45.67.89;branch=z9hG4bK2095962614
Call-ID: 459226380@sipz1
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=347609550
To: <sip:[email protected]>;tag=z9hG4bK2095962614
CSeq: 266 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1584896185/8983fac30130f93208deb23850a1c1b6",opaque="60a5c67760cbc4cf",algorithm=md5,qop="auth"
Server: My VoIP Server
Content-Length:  0


<--- Received SIP request (378 bytes) from UDP:123.45.67.89:5060 --->
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 123.45.67.89:5060;rport;branch=z9hG4bK2095962614
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=347609550
To: <sip:[email protected]:5060>;tag=z9hG4bK2095962614
Call-ID: 459226380@sipz1
CSeq: 266 ACK
Max-Forwards: 69
Contact: <sip:[email protected]:5060>
User-Agent: YATE
Content-Length: 0


<--- Received SIP request (669 bytes) from UDP:123.45.67.89:5060 --->
INVITE sip:[email protected]:5060 SIP/2.0
Max-Forwards: 69
Via: SIP/2.0/UDP 123.45.67.89:5060;rport;branch=z9hG4bK1866015583
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1029386465
To: <sip:[email protected]:5060>
Call-ID: 1191442533@sipz1
CSeq: 267 INVITE
User-Agent: YATE
Contact: <sip:[email protected]:5060>
Allow: ACK, INVITE, BYE, CANCEL, REGISTER, REFER, OPTIONS, INFO
Content-Type: application/sdp
Content-Length: 207

v=0
o=yate 1584896185 1584896185 IN IP4 123.45.67.89
s=SIP Call
c=IN IP4 123.45.67.89
t=0 0
m=audio 47466 RTP/AVP 8 0 101
a=rtpmap:8 PCMA/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:101 telephone-event/8000

<--- Transmitting SIP response (477 bytes) to UDP:123.45.67.89:5060 --->
SIP/2.0 401 Unauthorized
Via: SIP/2.0/UDP 123.45.67.89:5060;rport=5060;received=123.45.67.89;branch=z9hG4bK1866015583
Call-ID: 1191442533@sipz1
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1029386465
To: <sip:[email protected]>;tag=z9hG4bK1866015583
CSeq: 267 INVITE
WWW-Authenticate: Digest realm="asterisk",nonce="1584896185/8983fac30130f93208deb23850a1c1b6",opaque="3f5da1b24eef8229",algorithm=md5,qop="auth"
Server: My VoIP Server
Content-Length:  0


<--- Received SIP request (380 bytes) from UDP:123.45.67.89:5060 --->
ACK sip:[email protected]:5060 SIP/2.0
Via: SIP/2.0/UDP 123.45.67.89:5060;rport;branch=z9hG4bK1866015583
From: <sip:+49MYMOBILEPHONENUMBER@sipz1>;tag=1029386465
To: <sip:[email protected]:5060>;tag=z9hG4bK1866015583
Call-ID: 1191442533@sipz1
CSeq: 267 ACK
Max-Forwards: 69
Contact: <sip:[email protected]:5060>
User-Agent: YATE
Content-Length: 0
Anschließend ist besetzt.

Weiß jemand, was das Problem ist? Ich würde erstmal noch nicht viel zu meinen bisherigen Lösungsansätzen sagen, um nicht unnötig zu verwirren. Ich bitte euch ganz herzlich um eure Hilfe!


Herzlichen Dank!!


Freundliche Grüße
Tobi
 
Zuletzt bearbeitet:
Hilft dieser Post? Wenigstens für VoIP2GSM.

Allerdings verstehe ich die Thread-Überschrift nicht. Meine Vermutung: Du warst vorher auf dem Channel-Driver chan_sip. Bei dem hat alles geklappt. Du möchtest jetzt auch den Channel-Driver chan_pjsip wechseln. Damit gehen eingehende Anrufe nicht. In dem Fall: Hast Du bereits das Migrationskript probiert?
 
Zuletzt bearbeitet:
Hallo sonyKatze, herzlichen Dank für deine Mithilfe! Der Fehler ist nun behoben!
Allerdings verstehe ich die Thread-Überschrift nicht. Meine Vermutung: Du warst vorher auf dem Channel-Driver chan_sip. Bei dem hat alles geklappt. Du möchtest jetzt auch den Channel-Driver chan_pjsip wechseln. Damit gehen eingehende Anrufe nicht. In dem Fall: Hast Du bereits das Migrationskript probiert?
Du liegst genau richtig. Die oben gepostete Konfiguration der pjsip.conf ist unverändert vom Migrationsscript ausgegeben worden. Mit Generator (habe ich mittlerweile korrigiert) war das Migrationsscript gemeint, war etwas unglücklich von mir benannt.

Hilft dieser Post? Wenigstens für VoIP2GSM.
Ich hatte in der pjsip.conf gar keinen Wert für "realm" angegeben. Dies habe ich nachgeholt, was jedoch zu keiner Besserung führte.

Die Lösung:

Anschließend habe ich mal ganz frech meine Konfiguration an die des Thread Openers aus deinem Link angeglichen, wobei ich folgende Änderungen vornahm:
added "auth_type=userpass" to voipgsm registration
added "transport = transport-udp" to voipgsm endpoint
changed "outbound_auth" of voipgsm endpoint to "auth_reg_sipz1.voip2gsm.de"
removed "auth" from voipgsm endpoint
removed unused block "voipgsm" of type "auth"
added "send_rpid to voipgsm endpoint
added "trust_id_inbound" to voipgsm endpoint
added "trust_id_outbound" to voipgsm endpoint
removed "inband_progress" from voipgsm endpoint
added "disable_direct_media_on_nat" to voipgsm endpoint
removed "qualify" from voipgsm
added "qualify_frequency" to voipgsm aor


Geänderte Blöcke:
Code:
[voipgsm]
type = endpoint
transport = transport-udp
context = von-voipgsm
allow = !all,alaw,gsm,ulaw
from_domain = sipz1.voip2gsm.de
from_user = [MYUSER]
outbound_auth=auth_reg_sipz1.voip2gsm.de
aors=voipgsm
send_rpid=true
trust_id_inbound=true
trust_id_outbound=true
direct_media = no
allow_transfer = no
disable_direct_media_on_nat = yes
language = de

Code:
[auth_reg_sipz1.voip2gsm.de]
type = auth
auth_type=userpass
password = [MY PASSWORD]
username = [MYUSER]
realm=voip2gsm
Der Vollständigkeit halber:
Code:
[voipgsm]
type = aor
contact = sip:[MYUSER]@sipz1.voip2gsm.de:5060
max_contacts=100
qualify_frequency=180

Oder für andere mit dem gleichen Problem die kürzere Version: Einfach die Konfiguration vom TO kopieren und an die eigenen Gegebenheiten angleichen.

Und schon klappts! JUHUUU!! Dankeschön!


Liebe Grüße
Tobi
 
Zuletzt bearbeitet:
  • Love
Reaktionen: sonyKatze
Freut mich, dass der Link zu dem anderen Thread half. Hast Du eine Idee, was das Migrationsskript falsch gemacht hat oder gefehlt hat? Wenn wir das nämlich verbessern könnten, hätten bestimmt noch viel mehr etwas davon.
 
Kostenlos!

Statistik des Forums

Themen
248,854
Beiträge
2,302,942
Mitglieder
378,504
Neuestes Mitglied
Hallo61Hallo