Custom 'include' breaks call holding

I have two PBXs which are peered together, calling between the two PBXs works as expected.

PBX1 (Asterisk 1.4):
username=inter-pbx
type=peer
qualify=yes
insecure=very
host=XX.XX.XX.53
secret=XXXXXXXXXX
dtmfmode=rfc2833
disallow=all
context=from-internal
canreinvite=no
allow=ulaw

PBX2 (Asterisk 1.8):
username=inter-pbx
type=peer
host=XX.XX.XX.52
secret=XXXXXXXXXX
qualify=yes
dtmfmode=rfc2833
disallow=all
context=from-internal
allow=ulaw
directmedia=no

My issue is that I need to run an AGI script on every call that comes into PBX2 and when I augment the [from-internal-additional-custom] with the options below, my script is run and correctly assigns my variables, but then breaks call holding. (Also, if the answering extension hangs up, the call is not disconnected.)

What is the problem with this context config?

[from-internal-additional-custom]
exten => _.,1,AGI(lookup.php,${SIPCALLID})
exten => _.,n,Set(CXPOPCUSTOM=${lookupcid})
exten => _.,n,Set(PHONENAME=${phoneName})
exten => _.,n,Set(CALLERID(num)=FROM ${CALLERID(num)})
exten => _.,n,Set(CALLERID(name)=${CALLERID(name)}: ${CXPOPCUSTOM})
exten => _.,n,Goto(from-trunk,${EXTEN},1)

I feel as if ‘from-trunk’ is the wrong goto, but commenting it out or changing to from-internal breaks all calls into PBX2

Any information is appreciated!

the following line was the cause of the issue:

exten => _.,n,Set(CALLERID(num)=FROM ${CALLERID(num)})

The wonderful support of IRC led me to see that text in a number field is inadvisable for obvious reasons.