-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathtest_calls.sh
More file actions
executable file
·70 lines (58 loc) · 2.2 KB
/
Copy pathtest_calls.sh
File metadata and controls
executable file
·70 lines (58 loc) · 2.2 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
#!/bin/bash
# Call Testing Script for Android Nomad Gateway
export ANDROID_HOME=~/Library/Android/sdk
export PATH=$PATH:$ANDROID_HOME/emulator:$ANDROID_HOME/platform-tools
# Load configuration
WEBHOOK_URL="https://example.com/test_webhook"
TEST_PHONE="+1987654321"
echo "🔄 Testing call forwarding..."
echo "📞 Simulating incoming call to emulator..."
echo "🌐 Webhook endpoint: $WEBHOOK_URL"
# Simulate incoming call
echo "📱 Initiating call from $TEST_PHONE..."
adb emu gsm call "$TEST_PHONE"
if [ $? -eq 0 ]; then
echo "✅ Incoming call initiated!"
echo "⏱️ Letting call ring for 8 seconds to trigger call detection..."
sleep 8
echo "📞 Ending call..."
adb emu gsm cancel "$TEST_PHONE"
echo "✅ Call simulation complete!"
echo "📊 Check your webhook endpoint for the forwarded data."
echo "🔍 You can also check logs with: adb logcat | grep 'IncomingActivityGateway'"
# Wait for processing
echo "⏱️ Waiting 3 seconds for processing..."
sleep 3
# Test webhook connectivity
echo "🧪 Testing webhook connectivity..."
curl -s -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-H "User-Agent: Android-Nomad-Gateway-Test/1.0" \
-d '{
"from": "'"$TEST_PHONE"'",
"contact": "Unknown",
"timestamp": "'$(date +%s)'",
"duration": "8",
"type": "call",
"test": true
}' && echo "✅ Webhook connectivity test completed"
# Additional call state verification
echo "🔍 Checking call state in logs..."
adb logcat -d | grep -i "phone\|call\|telephony" | tail -5
else
echo "❌ Failed to simulate call. Make sure emulator is running and ADB is connected."
fi
echo ""
echo "Expected webhook payload:"
echo "{"
echo " \"from\": \"$TEST_PHONE\","
echo " \"contact\": \"Unknown\","
echo " \"timestamp\": \"[unix_timestamp]\","
echo " \"duration\": \"[call_duration]\","
echo " \"type\": \"call\""
echo "}"
echo ""
echo "💡 Note: Call detection requires:"
echo " 1. Phone permissions granted to the app"
echo " 2. CallBroadcastReceiver properly registered"
echo " 3. Phone state changes to be monitored"