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

Making outbound calls with UserAgentGui and UserAgentCli #18

Open
kwaggaz opened this issue Jul 30, 2024 · 0 comments
Open

Making outbound calls with UserAgentGui and UserAgentCli #18

kwaggaz opened this issue Jul 30, 2024 · 0 comments

Comments

@kwaggaz
Copy link

kwaggaz commented Jul 30, 2024

Hi,

I have successfully registered both the UserAgentGui and UserAgentCli to an Asterisk server. I can call both the UserAgentGui and UserAgentCli phones using another SIP phone, and I am able to answer the inbound calls and have successful conversations. However, I am unable to make outbound calls to another SIP phone on the same Asterisk server. I receive the following error:

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException: Cannot invoke "org.mjsip.sdp.SdpMessage.toString()" because "session_descriptor" is null
	at org.mjsip.sip.dialog.InviteDialog.invite(InviteDialog.java:315)
	at org.mjsip.sip.dialog.InviteDialog.inviteWithoutOffer(InviteDialog.java:367)
	at org.mjsip.sip.call.ExtendedCall.call(ExtendedCall.java:135)
	at org.mjsip.sip.call.Call.call(Call.java:183)
	at org.mjsip.sip.call.Call.call(Call.java:176)
	at org.mjsip.ua.UserAgent.call(UserAgent.java:180)
	at org.mjsip.ua.UserAgent.call(UserAgent.java:170)
	at org.mjsip.ua.UserAgent.call(UserAgent.java:156)
	at org.mjsip.phone.gui.UserAgentGui.jButton1_actionPerformed(UserAgentGui.java:431)
	at org.mjsip.phone.gui.UserAgentGui$2.actionPerformed(UserAgentGui.java:310)

I run both programs with the following parameters: -f ../mjsip.cfg --prefer-ipv4 true --address sip:[email protected]:5060
and with the following config file:

# 
#                   MjSip-1.7 Configuration File
# ________________________________________________________________
#
# This file inclues all MjSip configuration parameters.
# MjSip parameters are organized into 6 sections:
#  o Section 1: SipStack base configuration
#  o Section 2: Logs
#  o Section 3: SipProvider configuration
#  o Section 4: Server configuration
#  o Section 5: UA configuration
#  o Section 6: SBC configuration
#



# ________________________________________________________________
#
# Section 1: SipStack base configuration
# ________________________________________________________________
#
# Normally, you do not have to change the base configuration,
# and you can go directly to Section 2.
# SIP and transport layer configurations are handled in Section 3. 
#

# Default SIP port.
# Note that this is not the port used by the running stack, but simply the standard default SIP port.
# Normally it sould be set to 5060 as defined by RFC 3261. Using a different value may cause
# some problems when interacting with other unaware SIP UAs. 
# Default value: default_port=5060
#default_port=5060

# Default SIP port for TLS transport (SIPS).
# Note that this is not the port used by the running stack, but simply the standard default SIPS port.
# Normally it sould be set to 5061 as defined by RFC 3261. Using a different value may cause
# some problems when interacting with other unaware SIP UAs.
#default_tls_port=5061

# Default supported transport protocols.
# Default value: default_transport_protocols=udp,tcp
#default_transport_protocols=udp

# Default max number of contemporary open transport connections.
# Default value: default_nmax_connections=32
#default_nmax_connections=0

# Whether adding 'rport' parameter on via header fields of outgoing requests.
# Default value: use_rport=yes
#use_rport=no

# Whether adding (forcing) 'rport' parameter on via header field of incoming responses.
# Default value: force_rport=no
#force_rport=yes

# Starting retransmission timeout (milliseconds); called T1 in RFC2361; they suggest T1=500ms 
# Default value: retransmission_timeout=500
#retransmission_timeout=2000 

# Maximum retransmission timeout (milliseconds); called T2 in RFC2361; they suggest T2=4sec 
# Default value: max_retransmission_timeout=4000  
#max_retransmission_timeout=4000  

# Transaction timeout (milliseconds); RFC2361 suggests 64*T1=32000ms 
# Default value: transaction_timeout=32000
#transaction_timeout=10000    

# Clearing timeout (milliseconds); T4 in RFC2361; they suggest T4=5sec 
# Default value: clearing_timeout=5000
#clearing_timeout=5000

# Default max-forwards value (RFC3261 recommends value 70).
# Default value: max_forwards=70
#max_forwards=10

# Whether using only one thread for all timer instances (less precise but more efficient).
# Default value: single_timer=yes
#single_timer=no

# Whether at UAS side automatically sending (by default) a 100 Trying on INVITE.
# Default value: auto_trying=yes
#auto_trying=no

# Whether 1xx responses create an "early dialog" for methods that create dialog.
# Default value: early_dialog=no
#early_dialog=yes

# Default 'expires' time in seconds. RFC2361 gives as default value expires=3600 
# Default value: default_expires=3600
#default_expires=1800

# UA info included in request messages (in the User-Agent header field).
# Use 'NONE' string or let it blank if the User-Agent header filed must be added.
# Default value: ua_info=<the mjsip release>
# ua_info=NONE

# Server info included in request messages (in the Server header field).
# Use 'NONE' string or let it blank if the Server header filed must be added.
# Default value: server_info=<the mjsip release>
# server_info=NONE

# Starting registration timeout (msecs) after a registration failure due to request timeout.
# Default value: regc_min_attempt_timeout=60*1000 (that is 1min)
#regc_min_attempt_timeout=30*1000

# Maximum registration timeout (msecs) after a registration failure due to request timeout.
# Default value: regc_max_attempt_timeout=900*1000 (that is 15min)
#regc_max_attempt_timeout=600*1000

# Maximum number of consecutive registration authentication attempts before giving up.
# Default value: regc_auth_attempts=3
#regc_auth_attempts=5

# Whether forcing this node to stay within the dialog route as peer,
# by means of the insertion of a RecordRoute header.
# This is a non-standard behaviour and is normally not necessary.
# Default value: on_dialog_route=no
#on_dialog_route=yes



# ________________________________________________________________
#
# Section 3: SipProvider configuration
# ________________________________________________________________
#
# Change these parameters in order to customize the SIP transport layer.
# Usually you have to deal with some of these configuration parameters.
#

# Via IP address or fully-qualified domanin name (FQDN).
# Use 'AUTO-CONFIGURATION' for auto detection (or let it undefined).
# Default value: via_addr=AUTO-CONFIGURATION
via_addr=10.252.1.213

# Local SIP port.
# Default value: host_port=5060
#host_port=5060

# Network interface (IP address) used by SIP.
# Use 'all-interfaces' for binding SIP to all interfaces (or let it undefined).
# Default value: host_ifaddr=ALL-INTERFACES
#host_ifaddr=ALL-INTERFACES

# List of enabled transport protocols (the first protocol is used as default)
# Default value: transport_protocols=udp
transport_protocols=udp

# List of transport ports, ordered as the corresponding transport_protocols.
#transport_ports=5060,5060

# Max number of contemporary open transport connections.
# Default value: nmax_connections=32
#nmax_connections=0

# Outbound proxy URL ([sip:]host_addr[:host_port][;transport=proto]).
# Use 'NONE' for not using an outbound proxy (or let it undefined).
# Default value: outbound_proxy=NONE
#outbound_proxy=proxy.example.net:5060

# Whether logging all packets (including non-SIP keepalive tokens).
# Default value: log_all_packets=no
#log_all_packets=yes

# For TLS. Whether all client and server certificates should be considered trusted.
# By default, trust_all=no
#trust_all=yes

# For TLS. Path of the folder where trusted certificates are placed.
# All certificates (with file extension ".crt") found in this folder are considered trusted.
# By default, the folder "./cert" is used.
#trust_folder=cert

# For TLS. Absolute file name of the certificate (containing the public key) of the local node.
# The file name includes the full path starting from the current working folder.
# By default, the file "./cert/ssl.crt" is used.
#cert_file=cert/tls.crt

# For TLS. Absolute file name of the private key of the local node.
# The file name includes the full path starting from the current working folder.
# By default, the file "./cert/ssl.key" is used.
#key_file=cert/tls.key


# ________________________________________________________________
#
# Section 4: Server configuration
# ________________________________________________________________
#
# Change these parameters in order to customize the Server behaviour.
# You need to edit this section only if you are using a MjSip Server.
#

# The domain name(s) that the server administers.
# It lists the domain names for which the Location Service wmaintains user bindings. 
# Use 'auto-configuration' for automatic configuration of the domain name.
#domain_names=example.net example.com
#domain_names=AUTO-CONFIGURATION

# Whether consider any port as valid local domain port (regardless which sip port is used).
# Default value: domain_port_any=no
#domain_port_any=yes

# Whether the Server should act as Registrar (i.e. respond to REGISTER requests).    
# Default value: is_registrar=yes
#is_registrar=no

# Maximum expires time (in seconds).
# Default value: expires=3600
#expires=1800

# Whether the Registrar can register new users (i.e. REGISTER requests from unregistered users).    
# Default value: register_new_users=yes
#register_new_users=no

# Whether the Server relays requests for (or to) non-local users.   
# Default value: is_open_proxy=yes
#is_open_proxy=no

# The type of location service.
# You can specify the location service type (e.g. local, ldap, radius, mysql)
# or the class name (e.g. local.server.LocationServiceImpl).
# Default value: location_service=local
#location_service=ldap

# The name of the location DB.
# Default value: location_db=users.db
#location_db=config/users.db

# Whether location DB has to be cleaned at startup.
# Default value: clean_location_db=no
#clean_location_db=yes

# Whether the Server authenticates local users.   
# Default value: do_authentication=no
#do_authentication=yes

# Whether the Proxy authenticates users.
# Default value: do_proxy_authentication=no
#do_proxy_authentication=yes

# The authentication scheme.
# You can specify the authentication scheme name (e.g. Digest, AKA, etc.)
# or the class name (e.g. local.server.AuthenticationServerImpl).
# Default value: authentication_scheme=Digest
#authentication_scheme=AKA

# The authentication realm.
# If not defined or equal to 'NONE' (default), the used via address is used instead.
# Default value: authentication_realm=NONE
#authentication_realm=example.net

# The type of authentication service.
# You can specify the authentication service type (e.g. local, ldap, radius, mysql)
# or the class name (e.g. local.server.AuthenticationServiceImpl).
# Default value: authentication_service=local
#authentication_service=ldap

# The name of the authentication DB.
# Default value: authentication_db=aaa.db
#authentication_db=config/aaa.db

# Whether the server should stay in the signaling path (uses Record-Route/Route).
# Default value: on_route=no
#on_route=yes

# Whether implementing the RFC3261 Loose Route (or RFC2543 Strict Route) rule.
# Default value: loose_route=yes
#loose_route=no

# Whether checking for loops before forwarding a request (Loop Detection). In RFC3261 it is optional.
# Default value: loop_detection=yes
#loop_detection=no

# Proxy transaction timeout (in milliseconds), that corresponds to Timer "C" of RFC2361;
# RFC2361 suggests C>3min=180000ms.
# Default value: proxy_transaction_timeout=180000
#proxy_transaction_timeout=120000

# Sequence of pairs of username or phone prefix and corresponding nexthop address.
# It provides static rules for proxying number-based SIP-URL the server is responsible for.
# Use "default" (or "*") as default prefix.
# Example:
#   server is responsible for the domain 'example.com'
#   phone_proxying_rules={prefix=0123,nexthop=127.0.0.2:7002} {prefix=4567,nexthop=127.0.0.2:7003} {prefix=*,nexthop=127.0.0.3:7004}
#   a message with recipient 'sip:[email protected]' is forwarded to 'sip:[email protected]:7002'
#authenticated_phone_proxying_rules={prefix=0123,nexthop=127.0.0.2:7002}
#phone_proxying_rules={prefix=4567,nexthop=127.0.0.2:7003} {prefix=*,nexthop=127.0.0.3:7004}

# Sequence of pairs of destination domain and corresponding nexthop address.
# It provides static rules for proxying domain-based SIP-URL the server is NOT responsible for.
# It make the server acting (also) as 'Interrogating' Proxy, i.e. I-CSCF in the 3G networks.
# Example: <br>
#   server is responsible for the domain 'example.com'
#   domain_proxying_rules={domain=domain1.foo,nexthop=proxy.example.net:5060}
#   a message with recipient 'sip:[email protected]' is forwarded to 'sip:[email protected]:5060'
#authenticated_domain_proxying_rules={domain=domain1.foo,nexthop=192.168.0.4:5060}
#domain_proxying_rules={domain=domain2.foo,nexthop=192.168.0.5:5060}



# ________________________________________________________________
#
# Section 5: UA configuration
# ________________________________________________________________
#
# Change these parameters in order to customize the UA profile.
# You need to edit this section only if you are using a MjSip UA or
# you are managing 3PCC services.
#

# Display name for the user.
# It is used in the user's AOR registered to the registrar server and used as From URL.
display_name=777

# User's name.
# It is used to build the user's AOR registered to the registrar server and used as From URL.
user=777

# Fully qualified domain name (or address) of the proxy server.
# It is part of the user's AOR registered to the registrar server and used as From URL.
# If 'proxy' is not defined, the 'registrar' value is used in its place.
# If 'registrar' is not defined, the 'proxy' value is used in its place.
#proxy=proxy.example.net

# Fully qualified domain name (or address) of the registrar server.
# It is used as recipient for REGISTER requests.
# If 'registrar' is not defined, the 'proxy' value is used in its place.
# If 'proxy' is not defined, the 'registrar' value is used in its place.
registrar=10.252.1.213

# Contact URL.
# If not defined (default), it is formed as sip:user@via_addr:host_port.
# Normally you can leave it undefined.
#contact_url=sip:[email protected]:5070
#contact_url=sip:[email protected]:5060

# User's name used for server authentication.
auth_user=777

# User's realm used for server authentication.
auth_realm=asterisk

# User's passwd used for server authentication.
auth_passwd=password

# Absolute path (or complete URL) of the jar archive, where various UA media (gif, wav, etc.) are stored.
# Use value 'NONE' for getting resources from external folders.
# Default value: ua_jar=lib/ua.jar
#ua_jar=lib/ua.jar

# Absolute path (or complete URI) of the folder containing UA's resources.
# By default, the local folder "resources" is used.
#res_path=resources

# Relative path of UA media resources (gif, wav, etc.) within the UA jar file or within the resources folder. 
# By default, the folder "media/local/ua" is used.
#media_path=media/local/ua

# Absolute path (or complete URL) of the buddy list file where the buddy list is and loaded from (and saved to).
# Default value: buddy_list_file=buddy.lst
#buddy_list_file=config/buddy.lst

# Whether registering with the registrar server.
# Default value: do_register=no
do_register=yes

# Whether unregistering the contact address.
# Default value: do_unregister=no
#do_unregister=yes

# Whether unregistering all contacts beafore registering the contact address.
# Default value: do_unregister_all=no
#do_unregister_all=yes

# Expires time.
# Default value: expires=3600
# expires=1800

# Rate of keep-alive tokens (datagrams) sent toward the outbound proxy (if present) or toward the registrar server.
# Its value specifies the delta-time (in millesconds) between two keep-alive tokens.
# Set keepalive_time=0 for not sending keep-alive datagrams.
# Default value: keepalive_time=0
# keepalive_time=8000

# Automatic call a remote user secified by the 'call_to' value.
# Use value 'NONE' for manual calls (or let it undefined).
# Default value: call_to=NONE
#call_to=sip:[email protected]   
  
# Response time in seconds; it is the maximum time the user can wait before responding to an incoming call;
# after such time the call is automatically declined (refused).
# Default value: refuse_time=20

# Automatic answer time in seconds; time<0 corresponds to manual answer mode.
# Default value: accept_time=-1       
#accept_time=0

# Automatic hangup time (call duartion) in seconds; time<=0 corresponds to manual hangup mode.
# Default value: hangup_time=-1
#hangup_time=10

# Automatic call transfer time in seconds; time<0 corresponds to no auto transfer mode.
# Default value: transfer_time=-1
#transfer_time=10

# Automatic re-inviting time in seconds; time<0 corresponds to no auto re-invite mode.
# Default value: re_invite_time=-1
#re_invite_time=10

# Redirect incoming call to the secified url.
# Use value 'NONE' for not redirecting incoming calls (or let it undefined).
# Default value: redirect_to=NONE
#redirect_to=sip:[email protected]

# Transfer calls to the secified url.
# Use value 'NONE' for not transferring calls (or let it undefined).
# Default value: transfer_to=NONE
#transfer_to=sip:[email protected]

# No offer in the invite.
# Default value: no_offer=no
no_offer=yes

# Whether using audio.
# Default value: audio=no
audio=yes

# Whether using video.
# Default value: video=no
#video=yes

# Whether looping the received media streams back to the sender.
# Default value: loopback=no
#loopback=yes

# Whether playing in receive only mode.
# Default value: recv_only=no
#recv_only=yes

# Whether playing in send only mode.
# Default value: send_only=no
#send_only=yes

# Whether playing a test tone in send only mode.
# Default value: send_tone=no
#send_tone=yes

# Audio file to be played.
# Default value: send_file=NONE
#send_file=audio1.in

# Audio file to be recored.
# Default value: recv_file=NONE
#recv_file=audio1.out

# Media address (use it ONLY if you want to specify a media address different from the via address).
#media_addr=10.252.1.213

# First media port (use it ONLY if you want to specify media ports different from those specified by the 'media' parameter).
#media_port=7000

# Whether using symmetric_rtp.
# Default value: symmetric_rtp=no
#symmetric_rtp=yes

# Media descriptors:
# One or more 'media' (or 'media_desc') parameters specify for each supported media: the media type, port, and protocol/codec.
# Zero or more 'media_spec' parameters can be used to specify media attributes such as: codec name, sample rate, and frame size.
# Examples:
#   media=audio 4000 rtp/avp
#   media_spec=audio 0 PCMU 8000 160
#   media_spec=audio 8 PCMA 8000 160
#   media_spec=audio 101 G726-32 8000 80
#   media_spec=audio 102 G726-24 8000 60
#   media=video 3002 rtp/avp
#   media_spec=video 101
# Alternatively media attributes can be specified also within the 'media' parameter as comma-separated list between brackets.
# Examples:
#   media=audio 4000 rtp/avp {audio 0 PCMU 8000 160, audio 8 PCMA 8000 160}
#   media=video 3002 rtp/avp {video 101}
# Default values:
#media=audio 4000 rtp/avp
#media_spec=audio 0 PCMU 8000 160
#media=video 4002 rtp/avp
#media_spec=video 101
#media=audio 12506 RTP/AVP 0 8 101
media=audio 12858 RTP/AVP 0 101 {0 PCMU 8000 160, 8 PCMA 8000 160}

# Whether using JMF for audio streaming.
# Default value: use_jmf_audio=no
#use_jmf_audio=yes

# Whether using JMF for video streaming.
# Default value: use_jmf_video=yes
#use_jmf_video=no

# Whether using RAT (Robust Audio Tool) as audio sender/receiver.
# Default value: use_rat=no
#use_rat=yes

# RAT command-line executable.
# Default value: bin_rat=rat
#bin_rat=c:\programmi\mbone\rat

# Whether using VIC (Video Conferencing Tool) as video sender/receiver.
# Default value: use_vic=no
#use_vic=yes

# VIC command-line executable.
# Default value: bin_vic=vic
#bin_vic=c:\programmi\mbone\rat


# ________________________________________________________________
#
# Section 6: SBC
# ________________________________________________________________
#
# Change these parameters in order to customize the SessionBorderController (SBC) behaviour.
# You need to edit this section only if you are using a SBC.
#

# Maximum time that the UDP relay remains active without receiving UDP datagrams (in milliseconds).
# Default value: relay_timeout=60000

# Refresh time of address-binding cache (in milliseconds)
# Default value: binding_timeout=3600000

# Minimum time between two changes of peer address (in milliseconds)
# Default value: handover_time=0

# Rate of keep-alive datagrams sent toward all registered UAs (in milliseconds).
# Set keepalive_time=0 to disable the sending of keep-alive datagrams.
# Default value: keepalive_time=0

# Whether sending keepalive datagram to all contacted UAs (also toward non-registered UAs)
# Default value: keepalive_aggressive=no

# Minimum inter-packet departure time (in milliseconds).
# Set interpacket_time=0 to disable this option.
# Default value: interpacket_time=0 

# Whether intercepting media traffics.
# Default value: do_interception=no

# Whether injecting new media flows.
# Default value: do_active_interception=no

# Sink address for media traffic interception.
# Default value: sink_addr=127.0.0.1

# Sink port for media traffic interception.
# Default value: sink_port=0

# Media address.
# Default value: media_addr=0.0.0.0

# Available media ports.
# Default value: media_ports=41000-41499

# Backend proxy where all requests not coming from it are passed to. 
# It can be specified as FQDN or host_addr[:host_port].
# Use 'NONE' for not using a backend proxy (or let it undefined).
# Default value: backend_proxy=NONE
#backend_proxy=127.0.0.2:5069

Your help will be tremendously appreciated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant