Originate gets "404 Not Found"

Why the “404 Not found” from SIP INVITE generated from “channel originate”?
The phone seems to register OK. I have “senrpid = yes” in sip.conf
as was suggested by another user.

I’m guessing the problem is with the INVITE generated by the “channel originate” call.

  1. I’m not sure what’s incorrect, if anything, with the INVITE generated.
  2. If that is true, I don’t know how to configure Asterisk to generate the correct INVITE.

The general difference between these originate examples which fail with the “404 Not Found” response and the originate examples which I’ve gotten to work successfully is that the failed cases have user phones which have a more complicated registration process: chalange - authentication and they also use a different registration port “5260” instead of the default “5060”.

I would certainly appreciate any suggestions / ideas - I’m stumped?

From CLI output:
channel originate SIP/62021@192.168.90.50:5260 extension 51207
== Using SIP RTP CoS mark 5
Audio is at 10648
Adding codec 100002 (gsm) to SDP
Adding codec 100003 (ulaw) to SDP
Adding codec 100004 (alaw) to SDP
Adding codec 100017 (testlaw) to SDP
Adding non-codec 0x1 (telephone-event) to SDP
Reliably Transmitting (no NAT) to 192.168.90.50:5260:
INVITE sip:62021@192.168.90.50:5260 SIP/2.0
Via: SIP/2.0/UDP 192.168.15.224:5060;branch=z9hG4bK1c0d0bf1
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as5d3410a7
To: sip:62021@192.168.90.50:5260
Contact: sip:anonymous@192.168.15.224:5060
Call-ID: 2ab335f15deec5525a50158f7e2df117@192.168.15.224:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.12.1
Date: Tue, 09 Dec 2014 21:27:13 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 285

v=0
o=root 513210126 513210126 IN IP4 192.168.15.224
s=Asterisk PBX 11.12.1
c=IN IP4 192.168.15.224
t=0 0
m=audio 10648 RTP/AVP 3 0 8 101
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv


*CLI>
<— SIP read from UDP:192.168.90.50:5260 —>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.15.224:5060;branch=z9hG4bK1c0d0bf1;received=192.168.15.224
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as5d3410a7
To: sip:62021@192.168.90.50:5260;tag=00955CA4-2A7B-145D-AA6D-325AA8C0AA77-615809
Call-ID: 2ab335f15deec5525a50158f7e2df117@192.168.15.224:5060
CSeq: 102 INVITE
Content-Length: 0

From sip.conf:
; sip.conf 04dec2014
;
[general]

    registertimeout => 3600
    defaultexpiry => 3600
    allowexternaldomains = yes
    sendrpid = yes

; rpid_update = no ; In certain cases, the only method by which a connected line chg …

;
; ICM
;
register=>62021:password@192.168.90.50:5260/62021
; OXE
;
register=>51206:password@152.148.200.236:5060/51206
register=>51207:password@152.148.200.236:5060/51207

From CLI output (earlier) - The Registration:
[Dec 9 16:24:32] NOTICE[32535]: chan_sip.c:14991 sip_reregister: – Re-registration for 62021@192.168.90.50
REGISTER 11 headers, 0 lines
Reliably Transmitting (no NAT) to 192.168.90.50:5260:
REGISTER sip:192.168.90.50:5260 SIP/2.0
Via: SIP/2.0/UDP 192.168.15.224:5060;branch=z9hG4bK4c99839e
Max-Forwards: 70
From: sip:62021@192.168.90.50;tag=as5767814a
To: sip:62021@192.168.90.50
Call-ID: 39cb26c54a84669a2c61731e26e499d7@192.168.15.224
CSeq: 104 REGISTER
User-Agent: Asterisk PBX 11.12.1
Authorization: Digest username=“62021”, realm=“switch”, algorithm=MD5, uri=“sip:192.168.90.50:5260”, nonce=“008475F6-6879-1487-AA6D-325AA8C0AA77”, response=“f222e74872d8a0af2b81c3011f7ed353”, opaque=“737769746368”, qop=auth, cnonce=“015f1404”, nc=00000002
Expires: 3600
Contact: sip:62021@192.168.15.224:5060
Content-Length: 0


<— SIP read from UDP:192.168.90.50:5260 —>
SIP/2.0 200 OK
Via: SIP/2.0/UDP 192.168.15.224:5060;branch=z9hG4bK4c99839e;received=192.168.15.224
From: sip:62021@192.168.90.50;tag=as5767814a
To: sip:62021@192.168.90.50;tag=00955CA4-2A7B-145D-AA6D-325AA8C0AA77-615767
Call-ID: 39cb26c54a84669a2c61731e26e499d7@192.168.15.224
CSeq: 104 REGISTER
Server: SIP Server, 2.0.044.01
Expires: 1800
Contact: sip:62021@192.168.15.224:5060;expires=1800
Content-Length: 0

<------------->
— (10 headers 0 lines) —
[Dec 9 16:24:32] NOTICE[32535]: chan_sip.c:23504 handle_response_register: Outbound Registration: Expiry for 192.168.90.50 is 1800 sec (Scheduling reregistration in 1785 s)
Really destroying SIP dialog ‘39cb26c54a84669a2c61731e26e499d7@192.168.15.224’ Method: REGISTER

-UUU:----F1 originate_no_ip_in_from.txt

This is nothing to do with Originate, except that you have provided the wrong address information.

You will have to look at the remote system to find out why it thinks there is no resource with the URI sip:62021@192.168.90.50:5260

Also please note that Asterisk General is a discussion forum, not a support one.

Thanks for the suggestion.
But a question - You mention "Also please note that Asterisk General is a discussion forum, not a support one."
I thought that the question was a general Asterisk issue. What would be a better forum for such a question?

Asterisk Support (tag line: “Get help with installing, upgrading and running Asterisk”.)

The tag line of Asterisk General is “General discussions about Asterisk”.

After looking at our registrars log iit appears that the problem is that the INVITE generated by our Asterisk originate command includes “From: “Anonymous” sip:anonymous@anonymous.invalid” as well as “Contact: sip:anonymous@192.168.15.224:5060”.
Why is that? How can I avoid the “Anonymous” in the INVITE?

Thanks again for your attention and assistance.

The excerpt from the log follows.

16:27:13.074:(1) Received [11,UDP] 885 bytes from 192.168.15.224:5060 <<<<<
INVITE sip:62021@192.168.90.50:5260 SIP/2.0
Via: SIP/2.0/UDP 192.168.15.224:5060;branch=z9hG4bK1c0d0bf1
Max-Forwards: 70
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as5d3410a7
To: sip:62021@192.168.90.50:5260
Contact: sip:anonymous@192.168.15.224:5060
Call-ID: 2ab335f15deec5525a50158f7e2df117@192.168.15.224:5060
CSeq: 102 INVITE
User-Agent: Asterisk PBX 11.12.1
Date: Tue, 09 Dec 2014 21:27:13 GMT
Allow: INVITE, ACK, CANCEL, OPTIONS, BYE, REFER, SUBSCRIBE, NOTIFY, INFO, PUBLISH, MESSAGE
Supported: replaces, timer
Content-Type: application/sdp
Content-Length: 285

v=0
o=root 513210126 513210126 IN IP4 192.168.15.224
s=Asterisk PBX 11.12.1
c=IN IP4 192.168.15.224
t=0 0
m=audio 10648 RTP/AVP 3 0 8 101
a=rtpmap:3 GSM/8000
a=rtpmap:0 PCMU/8000
a=rtpmap:8 PCMA/8000
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-16
a=ptime:20
a=sendrecv

16:27:13.074:(1) Unable to resolve number for DN:anonymous
16:27:13.074:(1) Unable to resolve number for DN:anonymous
16:27:13.074:(1) trunk ip addr 192.168.15.224
16:27:13.074 Std 52002 Gateway for address ‘192.168.15.224’, number ‘anonymous’ is not found.
16:27:13.074:(1) CallMatcher: no call match attributes found
16:27:13.075:(1) Unable to resolve number for DN:anonymous
16:27:13.075:(1) Unable to resolve number for DN:anonymous
16:27:13.075:(1) trunk ip addr 192.168.15.224
16:27:13.075 Std 52002 Gateway for address ‘192.168.15.224’, number ‘anonymous’ is not found.
16:27:13.075:(1) ERROR: 10000002, GetDeviceManager().ResolveOriginationDevice(inviteMsg, from), SipCallManager.cpp,1297
16:27:13.075:(1) Sending [11,UDP] 362 bytes to 192.168.15.224:5060 >>>>>
SIP/2.0 404 Not Found
Via: SIP/2.0/UDP 192.168.15.224:5060;branch=z9hG4bK1c0d0bf1;received=192.168.15.224
From: “Anonymous” sip:anonymous@anonymous.invalid;tag=as5d3410a7
To: sip:62021@192.168.90.50:5260;tag=00955CA4-2A7B-145D-AA6D-325AA8C0AA77-6158

You will need to provide us with your configuration and details of the incoming caller ID.

404 is not really an appropriate response.

I’m a bit confused - I entered the CLI “originate” command. The SIP INVITE, with the Call-ID were generated by Asterisk. I’m tring to gain an understanding of Asterisk’s actions such as the “Anonymous” in the INVITE’s “From:” line.

The Asterisk invocation command:
asterisk -vvvvvvv -c -C /nfs/newadmin/public/users/crs/testbuddy/log/ast07/asterisk/asterisk.conf | tee asterisk_out_icm_07.txt

Console output (asterisk_out_icm_07.txt) is attached.

Once again, I am very greatful for your attention and assistance.

I tried attaching asterisk.conf, sip.conf,extensions.conf but got the message “The extension conf is not allowed”.

==========================================================================
manager.conf:

;
; AMI - The Asterisk Manager Interface
;
; Third party application call management support and PBX event supervision
;
; This configuration file is read every time someone logs in
;
; Use the “manager show commands” at the CLI to list available manager commands
; and their authorization levels.
;
; "manager show command " will show a help text.
;
; ---------------------------- SECURITY NOTE -------------------------------
; Note that you should not enable the AMI on a public IP address. If needed,
; block this TCP port with iptables (or another FW software) and reach it
; with IPsec, SSH, or SSL vpn tunnel. You can also make the manager
; interface available over http/https if Asterisk’s http server is enabled in
; http.conf and if both “enabled” and “webenabled” are set to yes in
; this file. Both default to no. httptimeout provides the maximum
; timeout in seconds before a web based session is discarded. The
; default is 60 seconds.
;
[general]
port = 5039
;enabled = no
;webenabled = yes
enabled = yes
webenabled=yes ; this enables the interaction between the Asterisk web server and AMI

[asterisk_http] ; you can name the user whatever you want
secret = gooey
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config
port = 5038
bindaddr = 0.0.0.0

[admin]
write = all,system,call,log,verbose,command,agent,user,config,command,reporting,originate,message
read = all,system,call,log,verbose,command,agent,user,config,user,config,dtmf,reporting,cdr,dialplan
writetimeout = 500
permit = 192.168.15.224
secret = secret

==========================================================================
asterisk.conf:

[directories]
astetcdir=/nfs/newadmin/public/users/crs/testbuddy/log/ast07/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /var/lib/asterisk
astagidir => /var/lib/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir=/nfs/newadmin/public/users/crs/testbuddy/log/ast07
astlogdir=/nfs/newadmin/public/users/crs/testbuddy/log/ast07
astsbindir => /usr/sbin

[options]
live_dangerously = yes
verbose = 3
;verbose = 3
;debug = 3
;alwaysfork = yes ; Same as -F at startup.
;nofork = yes ; Same as -f at startup.
;quiet = yes ; Same as -q at startup.
;timestamp = yes ; Same as -T at startup.
;execincludes = yes ; Support #exec in config files.
;console = yes ; Run as console (same as -c at startup).
;highpriority = yes ; Run realtime priority (same as -p at
; startup).
;initcrypto = yes ; Initialize crypto keys (same as -i at
; startup).
;nocolor = yes ; Disable console colors.
;dontwarn = yes ; Disable some warnings.
;dumpcore = yes ; Dump core on crash (same as -g at startup).
;languageprefix = yes ; Use the new sound prefix path syntax.
;systemname = my_system_name ; Prefix uniqueid with a system name for
; Global uniqueness issues.
;autosystemname = yes ; Automatically set systemname to hostname,
; uses ‘localhost’ on failure, or systemname if
; set.
;mindtmfduration = 80 ; Set minimum DTMF duration in ms (default 80 ms)
; If we get shorter DTMF messages, these will be
; changed to the minimum duration
;maxcalls = 10 ; Maximum amount of calls allowed.
;maxload = 0.9 ; Asterisk stops accepting new calls if the
; load average exceed this limit.
;maxfiles = 1000 ; Maximum amount of openfiles.
;minmemfree = 1 ; In MBs, Asterisk stops accepting new calls if
; the amount of free memory falls below this
; watermark.
;cache_record_files = yes ; Cache recorded sound files to another
; directory during recording.
;record_cache_dir = /tmp ; Specify cache directory (used in conjunction
; with cache_record_files).
;transmit_silence = yes ; Transmit silence while a channel is in a
; waiting state, a recording only state, or
; when DTMF is being generated. Note that the
; silence internally is generated in raw signed
; linear format. This means that it must be
; transcoded into the native format of the
; channel before it can be sent to the device.
; It is for this reason that this is optional,
; as it may result in requiring a temporary
; codec translation path for a channel that may
; not otherwise require one.
;transcode_via_sln = yes ; Build transcode paths via SLINEAR, instead of
; directly.
;runuser = asterisk ; The user to run as.
;rungroup = asterisk ; The group to run as.
;lightbackground = yes ; If your terminal is set for a light-colored
; background.
;forceblackbackground = yes ; Force the background of the terminal to be
; black, in order for terminal colors to show
; up properly.
;defaultlanguage = en ; Default language
documentation_language = en_US ; Set the language you want documentation
; displayed in. Value is in the same format as
; locale names.
;hideconnect = yes ; Hide messages displayed when a remote console
; connects and disconnects.
;lockconfdir = no ; Protect the directory containing the
; configuration files (/etc/asterisk) with a
; lock.
;stdexten = gosub ; How to invoke the extensions.conf stdexten.
; macro - Invoke the stdexten using a macro as
; done by legacy Asterisk versions.
; gosub - Invoke the stdexten using a gosub as
; documented in extensions.conf.sample.
; Default gosub.
; set to yes to allow testing
;live_dangerously = yes ; Enable the execution of ‘dangerous’ dialplan
; functions from external sources (AMI,
; etc.) These functions (such as SHELL) are
; considered dangerous because they can allow
; privilege escalation.
; Default yes, for backward compatability.

; Changing the following lines may compromise your security.
;[files]
;astctlpermissions = 0660
;astctlowner = root
;astctlgroup = apache
;astctl = asterisk.ctl

[compat]
pbx_realtime=1.6
res_agi=1.6
app_set=1.6

========================================================================
sip.conf:

; sip.conf 04dec2014
;
[general]

    registertimeout => 3600
    defaultexpiry => 3600
    allowexternaldomains = yes
    sendrpid = yes
    rpid_update = yes               ; In certain cases, the only method by which a connected line chg ...

;
; ICM
;
register=>62021:password@192.168.90.50:5260/62021
register=>62022:password@192.168.90.50:5260/62022
register=>62023:password@192.168.90.50:5260/62023
register=>62024:password@192.168.90.50:5260/62024
register=>62025:password@192.168.90.50:5260/62025
;
; OXE
;
register=>51206:password@152.148.200.236:5060/51206
register=>51207:password@152.148.200.236:5060/51207
register=>51208:password@152.148.200.236:5060/51208
register=>51209:password@152.148.200.236:5060/51209
register=>51210:password@152.148.200.236:5060/51210

========================================================================
extensions.conf:

;extensionis 04dec2014
;
[default]

    include => outgoing
    include => incoming
    exten => _X.,1,Goto(incoming,${EXTEN},1)

[outgoing]

        ;
        ; OXE phones
        ; registrar = ao1-oxe-ed.inse.lucent.com
        ; registrar ip = 152.148.200.236
        ;


            exten => 51206,1,Verbose(51206 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/51206@152.148.200.236:5060,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/51206@152.148.200.236:5060,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


            exten => 51207,1,Verbose(51207 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/51207@152.148.200.236:5060,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/51207@152.148.200.236:5060,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


            exten => 51208,1,Verbose(51208 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/51208@152.148.200.236:5060,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/51208@152.148.200.236:5060,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


            exten => 51209,1,Verbose(51209 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/51209@152.148.200.236:5060,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/51209@152.148.200.236:5060,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


            exten => 51210,1,Verbose(51210 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/51210@152.148.200.236:5060,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/51210@152.148.200.236:5060,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


        ;
        ; ICM phones
        ; registrar = ao1.tara.edial.office
        ; registrar ip = 192.168.90.50
        ;


            exten => 62021,1,Verbose(62021 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/62021@192.168.90.50:5260,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/62021@192.168.90.50:5260,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


            exten => 62022,1,Verbose(62022 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/62022@192.168.90.50:5260,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/62022@192.168.90.50:5260,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


            exten => 62023,1,Verbose(62023 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/62023@192.168.90.50:5260,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/62023@192.168.90.50:5260,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


            exten => 62024,1,Verbose(62024 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/62024@192.168.90.50:5260,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/62024@192.168.90.50:5260,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()


            exten => 62025,1,Verbose(62025 outgoing)
            same => n,Wait(1)
            same => n,Dial(SIP/62025@192.168.90.50:5260,20,rt)
            same => n,Wait(1)
            same => n,Dial(SIP/62025@192.168.90.50:5260,20,rt)
            same => n,Wait(99999)
            same => n,Hangup()

[incoming]

        ;
        ; OXE phones
        ; registrar = ao1-oxe-ed.inse.lucent.com
        ; registrar ip = 152.148.200.236
        ;


            exten => 51206,1(Read),Verbose(51206 incoming)
            same => n,Read(dtmf51206,,20,,,99999)
            same => n,SayDigits(${dtmf51206})
            same => n,wait(2)
            same => n,Goto(Read)


            exten => 51207,1(Read),Verbose(51207 incoming)
            same => n,Read(dtmf51207,,20,,,99999)
            same => n,SayDigits(${dtmf51207})
            same => n,wait(2)
            same => n,Goto(Read)


            exten => 51208,1(Read),Verbose(51208 incoming)
            same => n,Read(dtmf51208,,20,,,99999)
            same => n,SayDigits(${dtmf51208})
            same => n,wait(2)
            same => n,Goto(Read)


            exten => 51209,1(Read),Verbose(51209 incoming)
            same => n,Read(dtmf51209,,20,,,99999)
            same => n,SayDigits(${dtmf51209})
            same => n,wait(2)
            same => n,Goto(Read)


            exten => 51210,1(Read),Verbose(51210 incoming)
            same => n,Read(dtmf51210,,20,,,99999)
            same => n,SayDigits(${dtmf51210})
            same => n,wait(2)
            same => n,Goto(Read)


        ;
        ; ICM phones
        ; registrar = ao1.tara.edial.office
        ; registrar ip = 192.168.90.50
        ;


            exten => 62021,1(Read),Verbose(62021 incoming)
            same => n,Read(dtmf62021,,20,,,99999)
            same => n,SayDigits(${dtmf62021})
            same => n,wait(2)
            same => n,Goto(Read)


            exten => 62022,1(Read),Verbose(62022 incoming)
            same => n,Read(dtmf62022,,20,,,99999)
            same => n,SayDigits(${dtmf62022})
            same => n,wait(2)
            same => n,Goto(Read)


            exten => 62023,1(Read),Verbose(62023 incoming)
            same => n,Read(dtmf62023,,20,,,99999)
            same => n,SayDigits(${dtmf62023})
            same => n,wait(2)
            same => n,Goto(Read)


            exten => 62024,1(Read),Verbose(62024 incoming)
            same => n,Read(dtmf62024,,20,,,99999)
            same => n,SayDigits(${dtmf62024})
            same => n,wait(2)
            same => n,Goto(Read)


            exten => 62025,1(Read),Verbose(62025 incoming)
            same => n,Read(dtmf62025,,20,,,99999)
            same => n,SayDigits(${dtmf62025})
            same => n,wait(2)
            same => n,Goto(Read)

==========================================================================

Originate doesn’t set a caller ID by default (and I think you can only do so using AMI, or by originating to a local channel which then sets it.

I can’t remember whether not having a caller ID is sufficient to produce that From header, or whether one also need to have caller id presentation disallowed. In the latter case, you will definitely need to use a local channel.

If the ITSP wants a numeric address, but it can be fixed, you can use fromuser in sip.conf.

Note that I’m only using the CLI for investigation and simplifying my forum communication.
Our projected use is via AMI, using the Perl Asterisk::AMI module.
Do you know if the AMI originate command provides a mechanism for supplying the INVITE Call-Id, From:, and To: entries?

Thanks again for the information.

From = Caller ID yes.
Call-ID No (that should be treated as opaque).
To maybe, assuming that it accepts a third field in the dialstring.